Internally use named export in babel parser (#17482)

This commit is contained in:
fisker Cheung authored and GitHub committed 2025-05-14 12:45:30 +08:00
1 parent 78a0903b37
commit d932cf70df
3 files changed
+26 -28

No files matched your search

+12 -12
View File
@@ -237,21 +237,21 @@ const babelEstree = createBabelParser({
),
});
export default {
babel,
"babel-flow": babelFlow,
"babel-ts": babelTs,
/** @internal */
__js_expression: babelExpression,
__ts_expression: babelTSExpression,
export { babel, babelFlow as "babel-flow", babelTs as "babel-ts" };
/** @internal */
// eslint-disable-next-line simple-import-sort/exports
export {
babelExpression as __js_expression,
babelTSExpression as __ts_expression,
/** for vue filter */
__vue_expression: babelExpression,
babelExpression as __vue_expression,
/** for vue filter written in TS */
__vue_ts_expression: babelTSExpression,
babelTSExpression as __vue_ts_expression,
/** for vue event binding to handle semicolon */
__vue_event_binding: babel,
babel as __vue_event_binding,
/** for vue event binding written in TS to handle semicolon */
__vue_ts_event_binding: babelTs,
babelTs as __vue_ts_event_binding,
/** verify that we can print this AST */
__babel_estree: babelEstree,
babelEstree as __babel_estree,
};
+12 -14
View File
@@ -172,18 +172,16 @@ function assertJsonNode(node) {
}
}
const jsonParsers = {
json: createParser({
parse: (text) => parseJson(text),
hasPragma: () => true,
hasIgnorePragma: () => false,
}),
json5: createParser((text) => parseJson(text)),
jsonc: createParser((text) => parseJson(text, { allowEmpty: true })),
"json-stringify": createParser({
parse: (text) => parseJson(text, { allowComments: false }),
astFormat: "estree-json",
}),
};
const json = createParser({
parse: (text) => parseJson(text),
hasPragma: () => true,
hasIgnorePragma: () => false,
});
const json5 = createParser((text) => parseJson(text));
const jsonc = createParser((text) => parseJson(text, { allowEmpty: true }));
const jsonStringify = createParser({
parse: (text) => parseJson(text, { allowComments: false }),
astFormat: "estree-json",
});
export default jsonParsers;
export { json, json5, jsonc, jsonStringify as "json-stringify" };
+2 -2
View File
@@ -1,5 +1,5 @@
import babelParsers from "../language-js/parse/babel.js";
import * as babelParsers from "../language-js/parse/babel.js";
// JSON parsers are based on babel, bundle together to reduce package size
import jsonParsers from "../language-json/parser-json.js";
import * as jsonParsers from "../language-json/parser-json.js";
export const parsers = { ...babelParsers, ...jsonParsers };