diff --git a/scripts/build/packages/prettier.js b/scripts/build/packages/prettier.js index 9c4ac206e..552c7055a 100644 --- a/scripts/build/packages/prettier.js +++ b/scripts/build/packages/prettier.js @@ -503,7 +503,7 @@ const pluginFiles = [ input: "src/plugins/acorn.js", replaceModule: [ { - module: resolveEsmModulePath("espree"), + module: getPackageFile("espree"), process(text) { const lines = text.split("\n"); @@ -533,6 +533,18 @@ const pluginFiles = [ return text; }, }, + { + module: getPackageFile("espree/lib/espree.js"), + process(text) { + // We are currently not using tokens + text = text.replace( + 'import TokenTranslator from "./token-translator.js";', + "", + ); + text = text.replaceAll("options.tokens === true", "false"); + return text; + }, + }, { // We don't use value of JSXText module: getPackageFile("acorn-jsx/xhtml.js"), diff --git a/scripts/build/shims/colors.js b/scripts/build/shims/colors.js index 36bbfdb30..bed09e103 100644 --- a/scripts/build/shims/colors.js +++ b/scripts/build/shims/colors.js @@ -1,4 +1,4 @@ -const colors = new Proxy(String, { get: () => colors }); +const colors = /* @__PURE__ */ new Proxy(String, { get: () => colors }); export default colors; export const createColors = () => colors; diff --git a/scripts/build/shims/method-at.js b/scripts/build/shims/method-at.js index 07d1cfb2c..6f2f6509a 100644 --- a/scripts/build/shims/method-at.js +++ b/scripts/build/shims/method-at.js @@ -11,7 +11,7 @@ function stringOrArrayAt(index) { return this[index < 0 ? this.length + index : index]; } -const at = createMethodShim("at", function () { +const at = /* @__PURE__ */ createMethodShim("at", function () { // "relative indexing" is not available in Node.js v14 // `.at` method is slower than property access on Node.js v16 and v18, see #14396 // Only checked arrays and strings, since we haven't use `TypedArray`, and the transform only works for sources diff --git a/scripts/build/shims/method-find-last-index.js b/scripts/build/shims/method-find-last-index.js index 85d153487..673ebd51b 100644 --- a/scripts/build/shims/method-find-last-index.js +++ b/scripts/build/shims/method-find-last-index.js @@ -13,10 +13,13 @@ const arrayFindLastIndex = return -1; }; -const findLastIndex = createMethodShim("findLastIndex", function () { - if (Array.isArray(this)) { - return arrayFindLastIndex; - } -}); +const findLastIndex = /* @__PURE__ */ createMethodShim( + "findLastIndex", + function () { + if (Array.isArray(this)) { + return arrayFindLastIndex; + } + }, +); export default findLastIndex; diff --git a/scripts/build/shims/method-find-last.js b/scripts/build/shims/method-find-last.js index 0b7afce5d..82f52a51c 100644 --- a/scripts/build/shims/method-find-last.js +++ b/scripts/build/shims/method-find-last.js @@ -11,7 +11,7 @@ const arrayFindLast = } }; -const findLast = createMethodShim("findLast", function () { +const findLast = /* @__PURE__ */ createMethodShim("findLast", function () { if (Array.isArray(this)) { return arrayFindLast; } diff --git a/scripts/build/shims/method-is-well-formed.js b/scripts/build/shims/method-is-well-formed.js index 60b76ecf4..0aa06a0a4 100644 --- a/scripts/build/shims/method-is-well-formed.js +++ b/scripts/build/shims/method-is-well-formed.js @@ -33,10 +33,13 @@ const stringIsWellFormed = return true; }; -const isWellFormed = createMethodShim("isWellFormed", function () { - if (typeof this === "string") { - return stringIsWellFormed; - } -}); +const isWellFormed = /* @__PURE__ */ createMethodShim( + "isWellFormed", + function () { + if (typeof this === "string") { + return stringIsWellFormed; + } + }, +); export default isWellFormed; diff --git a/scripts/build/shims/method-replace-all.js b/scripts/build/shims/method-replace-all.js index a150a453f..bad906b4d 100644 --- a/scripts/build/shims/method-replace-all.js +++ b/scripts/build/shims/method-replace-all.js @@ -12,7 +12,7 @@ const stringReplaceAll = return this.split(pattern).join(replacement); }; -const replaceAll = createMethodShim("replaceAll", function () { +const replaceAll = /* @__PURE__ */ createMethodShim("replaceAll", function () { if (typeof this === "string") { return stringReplaceAll; } diff --git a/scripts/build/shims/method-to-reversed.js b/scripts/build/shims/method-to-reversed.js index 704157af9..df581c53d 100644 --- a/scripts/build/shims/method-to-reversed.js +++ b/scripts/build/shims/method-to-reversed.js @@ -6,7 +6,7 @@ const arrayToReversed = return [...this].reverse(); }; -const toReversed = createMethodShim("toReversed", function () { +const toReversed = /* @__PURE__ */ createMethodShim("toReversed", function () { if (Array.isArray(this)) { return arrayToReversed; }