Support import defer and import source in meriyah (#19721)

This commit is contained in:
fisker Cheung authored and GitHub committed 2026-07-29 22:10:20 +08:00
1 parent 2c700bc611
commit 9df49a5516
18 files changed
+55 -160

No files matched your search

+26 -3
View File
@@ -532,11 +532,34 @@ const pluginFiles = [
{
input: "src/plugins/meriyah.js",
replaceModule: [
// We don't use value of JSXText
{
module: resolveEsmModulePath("meriyah"),
find: "parser.tokenValue = decodeHTMLStrict(raw);",
replacement: "parser.tokenValue = raw;",
process(text) {
// `structuredClone` is used to clone node
text = outdent`
const structuredClone =
globalThis.structuredClone ??
((node) => ({ ...node, range: [...node.range] }));
${text}
`;
// We don't use value of JSXText
text = text.replace(
"const decodeMap = ",
"const decodeMap = undefined &&",
);
text = text.replace(
"const entities = ",
"const entities = undefined &&",
);
text = text.replaceAll(
"parser.tokenValue = decodeHTMLStrict(raw);",
"parser.tokenValue = raw;",
);
return text;
},
},
],
},
+1 -1
View File
@@ -28,7 +28,7 @@ const packageTransforms = new Map([
transforms["method-at"],
["@glimmer/syntax", "angular-estree-parser", "espree"],
],
[transforms["object-has-own"], ["@babel/parser", "meriyah", "graphql"]],
[transforms["object-has-own"], ["@babel/parser", "graphql"]],
[transforms["string-raw"], ["camelcase", "@angular/compiler", "js-yaml"]],
[transforms["method-is-well-formed"], ["meriyah"]],
/* spell-checker: enable */