@weapp-vite/ast 6.16.47 → 6.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/babel.mjs CHANGED
@@ -3,9 +3,6 @@ import { createRequire } from "node:module";
3
3
  const BABEL_TS_MODULE_PLUGINS = [
4
4
  "typescript",
5
5
  "decorators-legacy",
6
- "classProperties",
7
- "classPrivateProperties",
8
- "classPrivateMethods",
9
6
  "jsx"
10
7
  ];
11
8
  const BABEL_TS_MODULE_PARSER_OPTIONS = {
@@ -52,12 +49,7 @@ function getVisitorKeys() {
52
49
  function parseJsLike(source) {
53
50
  return parse(source, {
54
51
  sourceType: "module",
55
- plugins: [
56
- ...BABEL_TS_MODULE_PLUGINS,
57
- "dynamicImport",
58
- "optionalChaining",
59
- "nullishCoalescingOperator"
60
- ]
52
+ plugins: [...BABEL_TS_MODULE_PLUGINS]
61
53
  });
62
54
  }
63
55
  //#endregion
@@ -1,2 +1,35 @@
1
- import core_default, { NodePath, TransformOptions } from "@babel/core";
2
- export { type NodePath, type TransformOptions, core_default as default };
1
+ import * as BabelCore from "@babel/core";
2
+ import { InputOptions as TransformOptions, NodePath } from "@babel/core";
3
+
4
+ //#region src/babelCore.d.ts
5
+ declare const babelCore: typeof BabelCore;
6
+ declare const parse: {
7
+ (code: string, callback: {
8
+ (err: Error, ast: null): void;
9
+ (err: null, ast: import("@babel/parser").ParseResult | null): void;
10
+ }): void;
11
+ (code: string, opts: BabelCore.InputOptions | undefined | null, callback: {
12
+ (err: Error, ast: null): void;
13
+ (err: null, ast: import("@babel/parser").ParseResult | null): void;
14
+ }): void;
15
+ }, parseAsync: typeof BabelCore.parseAsync, parseSync: typeof BabelCore.parseSync, transform: {
16
+ (code: string, callback: {
17
+ (err: Error, file: null): void;
18
+ (err: null, file: BabelCore.FileResult | null): void;
19
+ }): void;
20
+ (code: string, opts: BabelCore.InputOptions | undefined | null, callback: {
21
+ (err: Error, file: null): void;
22
+ (err: null, file: BabelCore.FileResult | null): void;
23
+ }): void;
24
+ }, transformAsync: typeof BabelCore.transformAsync, transformFile: typeof BabelCore.transformFile, transformFileAsync: typeof BabelCore.transformFileAsync, transformFileSync: typeof BabelCore.transformFileSync, transformFromAst: {
25
+ (ast: BabelCore.types.File | BabelCore.types.Program, code: string, callback: {
26
+ (err: Error, file: null): void;
27
+ (err: null, file: BabelCore.FileResult | null): void;
28
+ }): void;
29
+ (ast: BabelCore.types.File | BabelCore.types.Program, code: string, opts: BabelCore.InputOptions | undefined | null, callback: {
30
+ (err: Error, file: null): void;
31
+ (err: null, file: BabelCore.FileResult | null): void;
32
+ }): void;
33
+ }, transformFromAstAsync: typeof BabelCore.transformFromAstAsync, transformFromAstSync: typeof BabelCore.transformFromAstSync, transformSync: typeof BabelCore.transformSync, types: typeof BabelCore.types, version: string;
34
+ //#endregion
35
+ export { type NodePath, type TransformOptions, babelCore as default, parse, parseAsync, parseSync, transform, transformAsync, transformFile, transformFileAsync, transformFileSync, transformFromAst, transformFromAstAsync, transformFromAstSync, transformSync, types, version };
@@ -1,2 +1,6 @@
1
- import core_default from "@babel/core";
2
- export { core_default as default };
1
+ import { createRequire } from "node:module";
2
+ //#region src/babelCore.ts
3
+ const babelCore = createRequire(import.meta.url)("@babel/core");
4
+ const { parse, parseAsync, parseSync, transform, transformAsync, transformFile, transformFileAsync, transformFileSync, transformFromAst, transformFromAstAsync, transformFromAstSync, transformSync, types, version } = babelCore;
5
+ //#endregion
6
+ export { babelCore as default, parse, parseAsync, parseSync, transform, transformAsync, transformFile, transformFileAsync, transformFileSync, transformFromAst, transformFromAstAsync, transformFromAstSync, transformSync, types, version };
@@ -4,8 +4,8 @@ import { Expression, ObjectExpression, ObjectMethod, ObjectProperty, PrivateName
4
4
  //#region src/babelNodes.d.ts
5
5
  declare function unwrapTypeScriptExpression(exp: Expression): Expression;
6
6
  declare function toStaticObjectKey(key: Expression | PrivateName | t.Identifier): string | null;
7
- declare function getObjectPropertyByKey(node: ObjectExpression, key: string): ObjectMethod | ObjectProperty | null;
8
- declare function getRenderPropertyFromComponentOptions(componentExpr: Expression): ObjectMethod | ObjectProperty | null;
7
+ declare function getObjectPropertyByKey(node: ObjectExpression, key: string): ObjectMethod | t.ObjectPropertyNonComputed | null;
8
+ declare function getRenderPropertyFromComponentOptions(componentExpr: Expression): ObjectMethod | t.ObjectPropertyNonComputed | null;
9
9
  declare function resolveRenderableExpression(node: ObjectMethod | ObjectProperty): Expression | null;
10
10
  declare function resolveRenderExpressionFromComponentOptions(componentExpr: Expression): Expression | null;
11
11
  //#endregion
package/dist/index.d.mts CHANGED
@@ -5,7 +5,7 @@ import { parseJsLikeWithEngine } from "./engine.mjs";
5
5
  import { ComponentPropMap, collectComponentPropsFromCode, collectComponentPropsWithBabel, collectComponentPropsWithOxc, extractComponentProperties, extractPropertiesObject, getStaticPropertyName, mapConstructorName, mayContainComponentPropsShape, mergeComponentPropTypes, resolveOptionsObjectExpression, resolveOptionsObjectExpressionWithBabel, resolveTypeFromNode } from "./operations/componentProps.mjs";
6
6
  import { FeatureFlagOptions, collectFeatureFlagsFromCode, collectFeatureFlagsWithBabel, collectFeatureFlagsWithOxc, consumeNamedFeatureFlag, consumeNamespaceFeatureFlag, mayContainFeatureFlagHints, registerNamedFeatureFlagLocal, registerNamespaceFeatureFlagLocal } from "./operations/featureFlags.mjs";
7
7
  import { JsxAutoComponentAnalysisOptions, JsxAutoComponentContext, JsxBabelModuleAnalysisOptions, JsxImportedComponent, collectJsxAutoComponentsFromCode, collectJsxAutoComponentsWithBabel, collectJsxAutoComponentsWithOxc, collectJsxImportedComponentsAndDefaultExportFromBabelAst, collectJsxTemplateTagsFromBabelExpression, collectJsxTemplateTagsFromOxc, createJsxImportedComponent, defaultIsDefineComponentSource, defaultResolveBabelComponentExpression, defaultResolveBabelRenderExpression, getJsxImportLocalName, getJsxImportedName, getJsxOxcStaticPropertyName, isJsxDefineComponentImportSpecifier, mayContainJsxAutoComponentEntry, resolveOxcComponentExpression, resolveOxcRenderExpression, unwrapOxcExpression } from "./operations/jsxAutoComponents.mjs";
8
- import { _ as collectOnPageScrollWarningsWithBabel, a as getLocationFromOffset, c as getOxcCallExpressionCalleeName, d as isOnPageScrollCallee, f as isOxcFunctionLike, g as collectPageScrollInspectionWithOxc, h as collectOnPageScrollWarningsWithOxc, i as getCallExpressionCalleeName, l as getOxcMemberExpressionPropertyName, m as isStaticPropertyName, n as createLineStartOffsets, o as getMemberExpressionPropertyName, p as isOxcOnPageScrollCallee, r as createWarningPrefix, s as getOnPageScrollCallbackArgument, t as collectOnPageScrollPerformanceWarnings, u as getOxcStaticPropertyName, v as collectPageScrollInspection } from "./onPageScroll-C1BbvMzn.mjs";
8
+ import { _ as collectOnPageScrollWarningsWithBabel, a as getLocationFromOffset, c as getOxcCallExpressionCalleeName, d as isOnPageScrollCallee, f as isOxcFunctionLike, g as collectPageScrollInspectionWithOxc, h as collectOnPageScrollWarningsWithOxc, i as getCallExpressionCalleeName, l as getOxcMemberExpressionPropertyName, m as isStaticPropertyName, n as createLineStartOffsets, o as getMemberExpressionPropertyName, p as isOxcOnPageScrollCallee, r as createWarningPrefix, s as getOnPageScrollCallbackArgument, t as collectOnPageScrollPerformanceWarnings, u as getOxcStaticPropertyName, v as collectPageScrollInspection } from "./onPageScroll-DpsTdS_S.mjs";
9
9
  import { hasPlatformApiMemberExpression, isPlatformApiIdentifier, isPlatformApiMemberExpression, mayContainPlatformApiAccess, mayContainPlatformApiIdentifierByText, platformApiIdentifierList, platformApiIdentifiers } from "./operations/platformApi.mjs";
10
10
  import { RequireToken, collectRequireTokens, getRequireAsyncLiteralToken, getStaticRequireLiteralValue, hasStaticRequireCall, isStaticRequireCall, mayContainRequireCallByText, mayContainStaticRequireLiteral } from "./operations/require.mjs";
11
11
  import { ScriptSetupImport, collectScriptSetupImportsFromCode, collectScriptSetupImportsWithBabel, collectScriptSetupImportsWithOxc, createScriptSetupImport, getScriptSetupImportedName, mayContainRelevantScriptSetupImports } from "./operations/scriptSetupImports.mjs";
@@ -27,7 +27,7 @@ declare function isOnPageScrollCallee(callee: t.Expression | t.V8IntrinsicIdenti
27
27
  declare function getCallExpressionCalleeName(callee: t.Expression | t.V8IntrinsicIdentifier): string | undefined;
28
28
  declare function getOnPageScrollCallbackArgument(node: {
29
29
  arguments?: Array<t.Expression | t.SpreadElement | t.ArgumentPlaceholder | null>;
30
- }): t.FunctionExpression | t.ArrowFunctionExpression | undefined;
30
+ }): t.ArrowFunctionExpression | t.FunctionExpression | undefined;
31
31
  declare function createWarningPrefix(filename: string, line?: number, column?: number): string;
32
32
  declare function getOxcStaticPropertyName(node: any): string | undefined;
33
33
  declare function getOxcMemberExpressionPropertyName(node: any): string | undefined;
@@ -1,2 +1,2 @@
1
- import { _ as collectOnPageScrollWarningsWithBabel, a as getLocationFromOffset, c as getOxcCallExpressionCalleeName, d as isOnPageScrollCallee, f as isOxcFunctionLike, g as collectPageScrollInspectionWithOxc, h as collectOnPageScrollWarningsWithOxc, i as getCallExpressionCalleeName, l as getOxcMemberExpressionPropertyName, m as isStaticPropertyName, n as createLineStartOffsets, o as getMemberExpressionPropertyName, p as isOxcOnPageScrollCallee, r as createWarningPrefix, s as getOnPageScrollCallbackArgument, t as collectOnPageScrollPerformanceWarnings, u as getOxcStaticPropertyName, v as collectPageScrollInspection } from "../onPageScroll-C1BbvMzn.mjs";
1
+ import { _ as collectOnPageScrollWarningsWithBabel, a as getLocationFromOffset, c as getOxcCallExpressionCalleeName, d as isOnPageScrollCallee, f as isOxcFunctionLike, g as collectPageScrollInspectionWithOxc, h as collectOnPageScrollWarningsWithOxc, i as getCallExpressionCalleeName, l as getOxcMemberExpressionPropertyName, m as isStaticPropertyName, n as createLineStartOffsets, o as getMemberExpressionPropertyName, p as isOxcOnPageScrollCallee, r as createWarningPrefix, s as getOnPageScrollCallbackArgument, t as collectOnPageScrollPerformanceWarnings, u as getOxcStaticPropertyName, v as collectPageScrollInspection } from "../onPageScroll-DpsTdS_S.mjs";
2
2
  export { collectOnPageScrollPerformanceWarnings, collectOnPageScrollWarningsWithBabel, collectOnPageScrollWarningsWithOxc, collectPageScrollInspection, collectPageScrollInspectionWithOxc, createLineStartOffsets, createWarningPrefix, getCallExpressionCalleeName, getLocationFromOffset, getMemberExpressionPropertyName, getOnPageScrollCallbackArgument, getOxcCallExpressionCalleeName, getOxcMemberExpressionPropertyName, getOxcStaticPropertyName, isOnPageScrollCallee, isOxcFunctionLike, isOxcOnPageScrollCallee, isStaticPropertyName };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@weapp-vite/ast",
3
3
  "type": "module",
4
- "version": "6.16.47",
4
+ "version": "6.17.0",
5
5
  "description": "weapp-vite 共享 AST 分析工具包,统一 Babel/Oxc 解析与常用分析操作",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -101,11 +101,11 @@
101
101
  "node": ">=20"
102
102
  },
103
103
  "dependencies": {
104
- "@babel/core": "^7.29.7",
105
- "@babel/generator": "^7.29.7",
106
- "@babel/parser": "^7.29.7",
107
- "@babel/traverse": "^7.29.7",
108
- "@babel/types": "^7.29.7",
104
+ "@babel/core": "^8.0.1",
105
+ "@babel/generator": "^8.0.0",
106
+ "@babel/parser": "^8.0.0",
107
+ "@babel/traverse": "^8.0.0",
108
+ "@babel/types": "^8.0.0",
109
109
  "@oxc-project/types": "^0.136.0",
110
110
  "oxc-parser": "^0.136.0",
111
111
  "oxc-walker": "^1.0.0",