@weapp-vite/ast 7.6.0 → 7.7.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.d.mts +0 -2
- package/dist/babel.mjs +1 -2
- package/dist/babelCore.d.mts +0 -2
- package/dist/babelCore.mjs +1 -2
- package/dist/babelLoader.d.mts +1 -3
- package/dist/babelLoader.mjs +1 -2
- package/dist/babelNodes.d.mts +1 -3
- package/dist/babelNodes.mjs +1 -2
- package/dist/{engine-CBE2OpFp.mjs → engine-DNS4Kzzw.mjs} +3 -6
- package/dist/engine.d.mts +2 -4
- package/dist/engine.mjs +1 -1
- package/dist/index.d.mts +2 -14
- package/dist/index.mjs +6 -9
- package/dist/{native-Bt7ZuZIc.mjs → native-D8RHiEuF.mjs} +4 -8
- package/dist/{onPageScroll-D-n7saS4.d.mts → onPageScroll-9kwtAWzG.d.mts} +2 -12
- package/dist/{onPageScroll-DvBA8vNH.mjs → onPageScroll-CN_ocv9l.mjs} +6 -10
- package/dist/operations/componentProps.d.mts +2 -4
- package/dist/operations/componentProps.mjs +2 -3
- package/dist/operations/featureFlags.d.mts +2 -4
- package/dist/operations/featureFlags.mjs +3 -4
- package/dist/operations/jsxAutoComponents.d.mts +2 -12
- package/dist/operations/jsxAutoComponents.mjs +4 -8
- package/dist/operations/onPageScroll.d.mts +1 -1
- package/dist/operations/onPageScroll.mjs +1 -1
- package/dist/operations/platformApi.d.mts +2 -4
- package/dist/operations/platformApi.mjs +3 -4
- package/dist/operations/require.d.mts +2 -4
- package/dist/operations/require.mjs +3 -4
- package/dist/operations/scriptSetupImports.d.mts +2 -4
- package/dist/operations/scriptSetupImports.mjs +2 -3
- package/dist/operations/setDataPick.d.mts +2 -4
- package/dist/operations/setDataPick.mjs +2 -3
- package/dist/{types-4qG2Ubmk.d.mts → types-urOiI-JL.d.mts} +0 -2
- package/dist/types.d.mts +1 -1
- package/package.json +8 -8
package/dist/babel.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
2
|
import { ParserOptions, ParserPlugin } from "@babel/parser";
|
|
3
|
-
//#region src/babel.d.ts
|
|
4
3
|
export declare const BABEL_TS_MODULE_PLUGINS: ParserPlugin[];
|
|
5
4
|
export declare const BABEL_TS_MODULE_PARSER_OPTIONS: ParserOptions;
|
|
6
5
|
type BabelTraverse = typeof import('@babel/traverse').default;
|
|
@@ -16,5 +15,4 @@ export declare const generate: GenerateFn;
|
|
|
16
15
|
export declare const parse: BabelParse;
|
|
17
16
|
export declare function getVisitorKeys(): typeof import('@babel/types').VISITOR_KEYS;
|
|
18
17
|
export declare function parseJsLike(source: string): t.File;
|
|
19
|
-
//#endregion
|
|
20
18
|
export {};
|
package/dist/babel.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
|
|
2
|
+
// src/babel.ts
|
|
3
3
|
const BABEL_TS_MODULE_PLUGINS = [
|
|
4
4
|
"typescript",
|
|
5
5
|
"decorators-legacy",
|
|
@@ -52,5 +52,4 @@ function parseJsLike(source) {
|
|
|
52
52
|
plugins: [...BABEL_TS_MODULE_PLUGINS]
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
//#endregion
|
|
56
55
|
export { BABEL_TS_MODULE_PARSER_OPTIONS, BABEL_TS_MODULE_PLUGINS, generate, getVisitorKeys, parse, parseJsLike, traverse };
|
package/dist/babelCore.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as BabelCore from "@babel/core";
|
|
2
2
|
import { InputOptions as TransformOptions, NodePath } from "@babel/core";
|
|
3
|
-
//#region src/babelCore.d.ts
|
|
4
3
|
declare const babelCore: typeof BabelCore;
|
|
5
4
|
export declare const parse: {
|
|
6
5
|
(code: string, callback: {
|
|
@@ -30,5 +29,4 @@ export declare const parse: {
|
|
|
30
29
|
(err: null, file: BabelCore.FileResult | null): void;
|
|
31
30
|
}): void;
|
|
32
31
|
}, transformFromAstAsync: typeof BabelCore.transformFromAstAsync, transformFromAstSync: typeof BabelCore.transformFromAstSync, transformSync: typeof BabelCore.transformSync, types: typeof BabelCore.types, version: string;
|
|
33
|
-
//#endregion
|
|
34
32
|
export { type NodePath, type TransformOptions, babelCore as default };
|
package/dist/babelCore.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
|
|
2
|
+
// src/babelCore.ts
|
|
3
3
|
const babelCore = createRequire(import.meta.url)("@babel/core");
|
|
4
4
|
const { parse, parseAsync, parseSync, transform, transformAsync, transformFile, transformFileAsync, transformFileSync, transformFromAst, transformFromAstAsync, transformFromAstSync, transformSync, types, version } = babelCore;
|
|
5
|
-
//#endregion
|
|
6
5
|
export { babelCore as default, parse, parseAsync, parseSync, transform, transformAsync, transformFile, transformFileAsync, transformFileSync, transformFromAst, transformFromAstAsync, transformFromAstSync, transformSync, types, version };
|
package/dist/babelLoader.d.mts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
//#region src/babelLoader.d.ts
|
|
2
1
|
/** 创建按需加载的 Babel 后端入口,在首次异步导入前完成同步 AST 依赖初始化。 */
|
|
3
|
-
export declare function createBabelBackendLoader<T>(importer: () => Promise<T>): () => Promise<T>;
|
|
4
|
-
//#endregion
|
|
2
|
+
export declare function createBabelBackendLoader<T>(importer: () => Promise<T>): () => Promise<T>;
|
package/dist/babelLoader.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
|
|
2
|
+
// src/babelLoader.ts
|
|
3
3
|
const nodeRequire = createRequire(import.meta.url);
|
|
4
4
|
let babelPrimed = false;
|
|
5
5
|
function primeBabelDependencies() {
|
|
@@ -29,5 +29,4 @@ function createBabelBackendLoader(importer) {
|
|
|
29
29
|
return loading;
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
//#endregion
|
|
33
32
|
export { createBabelBackendLoader };
|
package/dist/babelNodes.d.mts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
2
|
import { Expression, ObjectExpression, ObjectMethod, ObjectProperty, PrivateName } from "@babel/types";
|
|
3
|
-
//#region src/babelNodes.d.ts
|
|
4
3
|
export declare function unwrapTypeScriptExpression(exp: Expression): Expression;
|
|
5
4
|
export declare function toStaticObjectKey(key: Expression | PrivateName | t.Identifier): string | null;
|
|
6
5
|
export declare function getObjectPropertyByKey(node: ObjectExpression, key: string): ObjectMethod | t.ObjectPropertyNonComputed | null;
|
|
7
6
|
export declare function getRenderPropertyFromComponentOptions(componentExpr: Expression): ObjectMethod | t.ObjectPropertyNonComputed | null;
|
|
8
7
|
export declare function resolveRenderableExpression(node: ObjectMethod | ObjectProperty): Expression | null;
|
|
9
|
-
export declare function resolveRenderExpressionFromComponentOptions(componentExpr: Expression): Expression | null;
|
|
10
|
-
//#endregion
|
|
8
|
+
export declare function resolveRenderExpressionFromComponentOptions(componentExpr: Expression): Expression | null;
|
package/dist/babelNodes.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
|
-
|
|
2
|
+
// src/babelNodes.ts
|
|
3
3
|
function unwrapTypeScriptExpression(exp) {
|
|
4
4
|
let current = exp;
|
|
5
5
|
while (t.isTSAsExpression(current) || t.isTSTypeAssertion(current) || t.isTSNonNullExpression(current) || t.isParenthesizedExpression(current) || t.isTSInstantiationExpression(current)) {
|
|
@@ -62,5 +62,4 @@ function resolveRenderExpressionFromComponentOptions(componentExpr) {
|
|
|
62
62
|
if (!renderNode) return null;
|
|
63
63
|
return resolveRenderableExpression(renderNode);
|
|
64
64
|
}
|
|
65
|
-
//#endregion
|
|
66
65
|
export { getObjectPropertyByKey, getRenderPropertyFromComponentOptions, resolveRenderExpressionFromComponentOptions, resolveRenderableExpression, toStaticObjectKey, unwrapTypeScriptExpression };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseJsLike } from "./babel.mjs";
|
|
2
2
|
import { parseSync } from "oxc-parser";
|
|
3
|
-
|
|
3
|
+
// src/engines/babel.ts
|
|
4
4
|
/**
|
|
5
5
|
* Babel AST 引擎。
|
|
6
6
|
*/
|
|
@@ -10,8 +10,7 @@ const babelAstEngine = {
|
|
|
10
10
|
return parseJsLike(code);
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
//#region src/engines/oxc.ts
|
|
13
|
+
// src/engines/oxc.ts
|
|
15
14
|
/**
|
|
16
15
|
* Oxc AST 引擎。
|
|
17
16
|
*/
|
|
@@ -21,8 +20,7 @@ const oxcAstEngine = {
|
|
|
21
20
|
return parseSync(filename, code).program;
|
|
22
21
|
}
|
|
23
22
|
};
|
|
24
|
-
|
|
25
|
-
//#region src/engine.ts
|
|
23
|
+
// src/engine.ts
|
|
26
24
|
/**
|
|
27
25
|
* 统一解析 JS-like 源码,供 analysis 型 operation 复用。
|
|
28
26
|
*/
|
|
@@ -33,5 +31,4 @@ function parseJsLikeWithEngine(code, options) {
|
|
|
33
31
|
}
|
|
34
32
|
return babelAstEngine.parseJsLike(code);
|
|
35
33
|
}
|
|
36
|
-
//#endregion
|
|
37
34
|
export { oxcAstEngine as n, babelAstEngine as r, parseJsLikeWithEngine as t };
|
package/dist/engine.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { n as AstParserLike, t as AstEngineName } from "./types-
|
|
2
|
-
//#region src/engine.d.ts
|
|
1
|
+
import { n as AstParserLike, t as AstEngineName } from "./types-urOiI-JL.mjs";
|
|
3
2
|
/**
|
|
4
3
|
* 统一解析 JS-like 源码,供 analysis 型 operation 复用。
|
|
5
4
|
*/
|
|
@@ -7,5 +6,4 @@ export declare function parseJsLikeWithEngine(code: string, options?: {
|
|
|
7
6
|
engine?: AstEngineName;
|
|
8
7
|
filename?: string;
|
|
9
8
|
parserLike?: AstParserLike;
|
|
10
|
-
}): unknown;
|
|
11
|
-
//#endregion
|
|
9
|
+
}): unknown;
|
package/dist/engine.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as parseJsLikeWithEngine } from "./engine-
|
|
1
|
+
export { t as parseJsLikeWithEngine } from "./engine-DNS4Kzzw.mjs";
|
package/dist/index.d.mts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { BABEL_TS_MODULE_PARSER_OPTIONS, BABEL_TS_MODULE_PLUGINS, generate, getVisitorKeys, parse, parseJsLike, traverse } from "./babel.mjs";
|
|
2
2
|
import { getObjectPropertyByKey, getRenderPropertyFromComponentOptions, resolveRenderExpressionFromComponentOptions, resolveRenderableExpression, toStaticObjectKey, unwrapTypeScriptExpression } from "./babelNodes.mjs";
|
|
3
|
-
import { n as AstParserLike, r as WeappAstConfig, t as AstEngineName } from "./types-
|
|
3
|
+
import { n as AstParserLike, r as WeappAstConfig, t as AstEngineName } from "./types-urOiI-JL.mjs";
|
|
4
4
|
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, collectFeatureFlagsWithNative, collectFeatureFlagsWithNativeBatch, 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 collectPageScrollInspectionWithOxc, a as getCallExpressionCalleeName, c as getOnPageScrollCallbackArgument, d as getOxcStaticPropertyName, f as isOnPageScrollCallee, g as collectOnPageScrollWarningsWithOxc, h as isStaticPropertyName, i as createWarningPrefix, l as getOxcCallExpressionCalleeName, m as isOxcOnPageScrollCallee, n as collectOnPageScrollWarningsWithNative, o as getLocationFromOffset, p as isOxcFunctionLike, r as createLineStartOffsets, s as getMemberExpressionPropertyName, t as collectOnPageScrollPerformanceWarnings, u as getOxcMemberExpressionPropertyName, v as collectOnPageScrollWarningsWithBabel, y as collectPageScrollInspection } from "./onPageScroll-
|
|
8
|
+
import { _ as collectPageScrollInspectionWithOxc, a as getCallExpressionCalleeName, c as getOnPageScrollCallbackArgument, d as getOxcStaticPropertyName, f as isOnPageScrollCallee, g as collectOnPageScrollWarningsWithOxc, h as isStaticPropertyName, i as createWarningPrefix, l as getOxcCallExpressionCalleeName, m as isOxcOnPageScrollCallee, n as collectOnPageScrollWarningsWithNative, o as getLocationFromOffset, p as isOxcFunctionLike, r as createLineStartOffsets, s as getMemberExpressionPropertyName, t as collectOnPageScrollPerformanceWarnings, u as getOxcMemberExpressionPropertyName, v as collectOnPageScrollWarningsWithBabel, y as collectPageScrollInspection } from "./onPageScroll-9kwtAWzG.mjs";
|
|
9
9
|
import { hasPlatformApiMemberExpression, isPlatformApiIdentifier, isPlatformApiMemberExpression, mayContainPlatformApiAccess, mayContainPlatformApiIdentifierByText, platformApiIdentifierList, platformApiIdentifiers } from "./operations/platformApi.mjs";
|
|
10
10
|
import { DynamicImportToken, RequireCallbackToken, RequireToken, collectRequireTokens, getDynamicImportLiteralToken, getRequireAsyncLiteralToken, getRequireCallbackLiteralToken, getStaticRequireLiteralValue, hasStaticRequireCall, isStaticRequireCall, mayContainRequireCallByText, mayContainStaticRequireLiteral } from "./operations/require.mjs";
|
|
11
11
|
import { ScriptSetupImport, collectScriptSetupImportsFromCode, collectScriptSetupImportsWithBabel, collectScriptSetupImportsWithOxc, createScriptSetupImport, getScriptSetupImportedName, mayContainRelevantScriptSetupImports } from "./operations/scriptSetupImports.mjs";
|
|
12
12
|
import { collectIdentifiersFromExpression, collectIdentifiersFromExpressionWithOxc, collectLoopScopeAliases, collectPatternBindingNames, collectSetDataPickKeysFromTemplateCode, collectSetDataPickKeysWithBabel, collectSetDataPickKeysWithOxc, extractTemplateExpressions, hasBindingInScopes } from "./operations/setDataPick.mjs";
|
|
13
|
-
//#region src/engines/babel.d.ts
|
|
14
13
|
/**
|
|
15
14
|
* Babel AST 引擎。
|
|
16
15
|
*/
|
|
@@ -18,8 +17,6 @@ export declare const babelAstEngine: {
|
|
|
18
17
|
name: "babel";
|
|
19
18
|
parseJsLike(code: string): import("@babel/types").File;
|
|
20
19
|
};
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/engines/oxc.d.ts
|
|
23
20
|
/**
|
|
24
21
|
* Oxc AST 引擎。
|
|
25
22
|
*/
|
|
@@ -27,8 +24,6 @@ export declare const oxcAstEngine: {
|
|
|
27
24
|
name: "oxc";
|
|
28
25
|
parseJsLike(code: string, filename?: string): import("oxc-parser").Program;
|
|
29
26
|
};
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region src/native/npmChunks.d.ts
|
|
32
27
|
interface NativeNpmChunkAnalysisInput {
|
|
33
28
|
code: string;
|
|
34
29
|
filename?: string;
|
|
@@ -56,8 +51,6 @@ interface NativeNpmChunkAnalysis {
|
|
|
56
51
|
platformApiRanges: NativeNpmPlatformApiFact[];
|
|
57
52
|
localRootFacts: NativeNpmLocalRootFact[];
|
|
58
53
|
}
|
|
59
|
-
//#endregion
|
|
60
|
-
//#region src/native.d.ts
|
|
61
54
|
interface NativeCompilerScriptInput {
|
|
62
55
|
code: string;
|
|
63
56
|
filename?: string;
|
|
@@ -96,8 +89,6 @@ export declare function analyzeCompilerScriptsWithNative(inputs: NativeCompilerS
|
|
|
96
89
|
* 批量读取最终 chunk 的重写事实;默认关闭,任何批次或单项校验失败都交回 JS。
|
|
97
90
|
*/
|
|
98
91
|
export declare function analyzeNpmChunksWithNative(inputs: NativeNpmChunkAnalysisInput[]): (NativeNpmChunkAnalysis | null)[] | undefined;
|
|
99
|
-
//#endregion
|
|
100
|
-
//#region src/operations/scriptAnalysis.d.ts
|
|
101
92
|
interface ScriptAnalysisOptions<TFeature extends string = string> {
|
|
102
93
|
engine?: AstEngineName;
|
|
103
94
|
parserLike?: AstParserLike;
|
|
@@ -121,8 +112,6 @@ export declare function analyzeScript<TFeature extends string = string>(code: st
|
|
|
121
112
|
* 批次只跨 native 边界一次,失败项各自执行一次完整 JS fallback。
|
|
122
113
|
*/
|
|
123
114
|
export declare function analyzeScripts<TFeature extends string = string>(inputs: ScriptAnalysisBatchInput<TFeature>[], options?: ScriptAnalysisOptions<TFeature>): Array<ScriptAnalysisResult<TFeature>>;
|
|
124
|
-
//#endregion
|
|
125
|
-
//#region src/operations/scriptLiterals.d.ts
|
|
126
115
|
/**
|
|
127
116
|
* 收集脚本中的字符串字面量源码片段,供上层语义按需筛选。
|
|
128
117
|
*/
|
|
@@ -135,5 +124,4 @@ export declare function collectScriptCallStringLiterals(code: string): string[];
|
|
|
135
124
|
* 快速判断脚本是否包含调用或模块语法,避免上层无条件扩大候选集。
|
|
136
125
|
*/
|
|
137
126
|
export declare function mayContainScriptCallOrModuleSyntax(code: string): boolean;
|
|
138
|
-
//#endregion
|
|
139
127
|
export { type AstEngineName, type AstParserLike, BABEL_TS_MODULE_PARSER_OPTIONS, BABEL_TS_MODULE_PLUGINS, type ComponentPropMap, type DynamicImportToken, type FeatureFlagOptions, type JsxAutoComponentAnalysisOptions, type JsxAutoComponentContext, type JsxBabelModuleAnalysisOptions, type JsxImportedComponent, type NativeCompilerRegisteredComponent, type NativeCompilerScriptAnalysis, type NativeCompilerScriptImport, type NativeCompilerScriptInput, type NativeCompilerScriptSpan, type NativeNpmChunkAnalysis, type NativeNpmChunkAnalysisInput, type NativeNpmLocalRootFact, type NativeNpmPlatformApiFact, type NativeNpmRequireFact, type RequireCallbackToken, type RequireToken, type ScriptAnalysisBatchInput, type ScriptAnalysisOptions, type ScriptAnalysisResult, type ScriptSetupImport, type WeappAstConfig, collectComponentPropsFromCode, collectComponentPropsWithBabel, collectComponentPropsWithOxc, collectFeatureFlagsFromCode, collectFeatureFlagsWithBabel, collectFeatureFlagsWithNative, collectFeatureFlagsWithNativeBatch, collectFeatureFlagsWithOxc, collectIdentifiersFromExpression, collectIdentifiersFromExpressionWithOxc, collectJsxAutoComponentsFromCode, collectJsxAutoComponentsWithBabel, collectJsxAutoComponentsWithOxc, collectJsxImportedComponentsAndDefaultExportFromBabelAst, collectJsxTemplateTagsFromBabelExpression, collectJsxTemplateTagsFromOxc, collectLoopScopeAliases, collectOnPageScrollPerformanceWarnings, collectOnPageScrollWarningsWithBabel, collectOnPageScrollWarningsWithNative, collectOnPageScrollWarningsWithOxc, collectPageScrollInspection, collectPageScrollInspectionWithOxc, collectPatternBindingNames, collectRequireTokens, collectScriptSetupImportsFromCode, collectScriptSetupImportsWithBabel, collectScriptSetupImportsWithOxc, collectSetDataPickKeysFromTemplateCode, collectSetDataPickKeysWithBabel, collectSetDataPickKeysWithOxc, consumeNamedFeatureFlag, consumeNamespaceFeatureFlag, createJsxImportedComponent, createLineStartOffsets, createScriptSetupImport, createWarningPrefix, defaultIsDefineComponentSource, defaultResolveBabelComponentExpression, defaultResolveBabelRenderExpression, extractComponentProperties, extractPropertiesObject, extractTemplateExpressions, generate, getCallExpressionCalleeName, getDynamicImportLiteralToken, getJsxImportLocalName, getJsxImportedName, getJsxOxcStaticPropertyName, getLocationFromOffset, getMemberExpressionPropertyName, getObjectPropertyByKey, getOnPageScrollCallbackArgument, getOxcCallExpressionCalleeName, getOxcMemberExpressionPropertyName, getOxcStaticPropertyName, getRenderPropertyFromComponentOptions, getRequireAsyncLiteralToken, getRequireCallbackLiteralToken, getScriptSetupImportedName, getStaticPropertyName, getStaticRequireLiteralValue, getVisitorKeys, hasBindingInScopes, hasPlatformApiMemberExpression, hasStaticRequireCall, isJsxDefineComponentImportSpecifier, isOnPageScrollCallee, isOxcFunctionLike, isOxcOnPageScrollCallee, isPlatformApiIdentifier, isPlatformApiMemberExpression, isStaticPropertyName, isStaticRequireCall, mapConstructorName, mayContainComponentPropsShape, mayContainFeatureFlagHints, mayContainJsxAutoComponentEntry, mayContainPlatformApiAccess, mayContainPlatformApiIdentifierByText, mayContainRelevantScriptSetupImports, mayContainRequireCallByText, mayContainStaticRequireLiteral, mergeComponentPropTypes, parse, parseJsLike, parseJsLikeWithEngine, platformApiIdentifierList, platformApiIdentifiers, registerNamedFeatureFlagLocal, registerNamespaceFeatureFlagLocal, resolveOptionsObjectExpression, resolveOptionsObjectExpressionWithBabel, resolveOxcComponentExpression, resolveOxcRenderExpression, resolveRenderExpressionFromComponentOptions, resolveRenderableExpression, resolveTypeFromNode, toStaticObjectKey, traverse, unwrapOxcExpression, unwrapTypeScriptExpression };
|
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { BABEL_TS_MODULE_PARSER_OPTIONS, BABEL_TS_MODULE_PLUGINS, generate, getVisitorKeys, parse, parseJsLike, traverse } from "./babel.mjs";
|
|
2
2
|
import { getObjectPropertyByKey, getRenderPropertyFromComponentOptions, resolveRenderExpressionFromComponentOptions, resolveRenderableExpression, toStaticObjectKey, unwrapTypeScriptExpression } from "./babelNodes.mjs";
|
|
3
|
-
import { n as oxcAstEngine, r as babelAstEngine, t as parseJsLikeWithEngine } from "./engine-
|
|
4
|
-
import { i as analyzeScriptsWithNative, n as analyzeNpmChunksWithNative, o as shouldUseNativeAst, r as analyzeScriptWithNative, t as analyzeCompilerScriptsWithNative } from "./native-
|
|
3
|
+
import { n as oxcAstEngine, r as babelAstEngine, t as parseJsLikeWithEngine } from "./engine-DNS4Kzzw.mjs";
|
|
4
|
+
import { i as analyzeScriptsWithNative, n as analyzeNpmChunksWithNative, o as shouldUseNativeAst, r as analyzeScriptWithNative, t as analyzeCompilerScriptsWithNative } from "./native-D8RHiEuF.mjs";
|
|
5
5
|
import { collectComponentPropsFromCode, collectComponentPropsWithBabel, collectComponentPropsWithOxc, extractComponentProperties, extractPropertiesObject, getStaticPropertyName, mapConstructorName, mayContainComponentPropsShape, mergeComponentPropTypes, resolveOptionsObjectExpression, resolveOptionsObjectExpressionWithBabel, resolveTypeFromNode } from "./operations/componentProps.mjs";
|
|
6
6
|
import { collectFeatureFlagsFromCode, collectFeatureFlagsWithBabel, collectFeatureFlagsWithNative, collectFeatureFlagsWithNativeBatch, collectFeatureFlagsWithOxc, consumeNamedFeatureFlag, consumeNamespaceFeatureFlag, mayContainFeatureFlagHints, registerNamedFeatureFlagLocal, registerNamespaceFeatureFlagLocal } from "./operations/featureFlags.mjs";
|
|
7
7
|
import { 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 isOxcFunctionLike, a as collectOnPageScrollWarningsWithBabel, c as createWarningPrefix, d as getMemberExpressionPropertyName, f as getOnPageScrollCallbackArgument, g as isOnPageScrollCallee, h as getOxcStaticPropertyName, i as collectPageScrollInspectionWithOxc, l as getCallExpressionCalleeName, m as getOxcMemberExpressionPropertyName, n as collectOnPageScrollWarningsWithNative, o as collectPageScrollInspection, p as getOxcCallExpressionCalleeName, r as collectOnPageScrollWarningsWithOxc, s as createLineStartOffsets, t as collectOnPageScrollPerformanceWarnings, u as getLocationFromOffset, v as isOxcOnPageScrollCallee, y as isStaticPropertyName } from "./onPageScroll-
|
|
8
|
+
import { _ as isOxcFunctionLike, a as collectOnPageScrollWarningsWithBabel, c as createWarningPrefix, d as getMemberExpressionPropertyName, f as getOnPageScrollCallbackArgument, g as isOnPageScrollCallee, h as getOxcStaticPropertyName, i as collectPageScrollInspectionWithOxc, l as getCallExpressionCalleeName, m as getOxcMemberExpressionPropertyName, n as collectOnPageScrollWarningsWithNative, o as collectPageScrollInspection, p as getOxcCallExpressionCalleeName, r as collectOnPageScrollWarningsWithOxc, s as createLineStartOffsets, t as collectOnPageScrollPerformanceWarnings, u as getLocationFromOffset, v as isOxcOnPageScrollCallee, y as isStaticPropertyName } from "./onPageScroll-CN_ocv9l.mjs";
|
|
9
9
|
import { hasPlatformApiMemberExpression, isPlatformApiIdentifier, isPlatformApiMemberExpression, mayContainPlatformApiAccess, mayContainPlatformApiIdentifierByText, platformApiIdentifierList, platformApiIdentifiers } from "./operations/platformApi.mjs";
|
|
10
10
|
import { collectRequireTokens, getDynamicImportLiteralToken, getRequireAsyncLiteralToken, getRequireCallbackLiteralToken, getStaticRequireLiteralValue, hasStaticRequireCall, isStaticRequireCall, mayContainRequireCallByText, mayContainStaticRequireLiteral } from "./operations/require.mjs";
|
|
11
11
|
import { collectScriptSetupImportsFromCode, collectScriptSetupImportsWithBabel, collectScriptSetupImportsWithOxc, createScriptSetupImport, getScriptSetupImportedName, mayContainRelevantScriptSetupImports } from "./operations/scriptSetupImports.mjs";
|
|
12
12
|
import { collectIdentifiersFromExpression, collectIdentifiersFromExpressionWithOxc, collectLoopScopeAliases, collectPatternBindingNames, collectSetDataPickKeysFromTemplateCode, collectSetDataPickKeysWithBabel, collectSetDataPickKeysWithOxc, extractTemplateExpressions, hasBindingInScopes } from "./operations/setDataPick.mjs";
|
|
13
|
-
|
|
13
|
+
// src/operations/internal/scriptAnalysis.ts
|
|
14
14
|
/** 复用既有 JS collector 的预筛选和失败语义,不尝试 native。 */
|
|
15
15
|
function collectFeatureFlagsWithJs(code, options) {
|
|
16
16
|
if (!mayContainFeatureFlagHints(code, options.moduleId, options.hookToFeature)) return /* @__PURE__ */ new Set();
|
|
@@ -45,8 +45,7 @@ const jsScriptAnalysisService = {
|
|
|
45
45
|
return mayContainScriptFactWithJs(code, options, mayContainRequireCallByText, hasStaticRequireCall);
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
|
|
49
|
-
//#region src/operations/scriptAnalysis.ts
|
|
48
|
+
// src/operations/scriptAnalysis.ts
|
|
50
49
|
function normalizeNativeAnalysis(nativeAnalysis, featureFlags) {
|
|
51
50
|
const validFeatures = new Set(Object.values(featureFlags?.hookToFeature ?? {}));
|
|
52
51
|
const enabled = /* @__PURE__ */ new Set();
|
|
@@ -108,8 +107,7 @@ function analyzeScripts(inputs, options) {
|
|
|
108
107
|
});
|
|
109
108
|
});
|
|
110
109
|
}
|
|
111
|
-
|
|
112
|
-
//#region src/operations/scriptLiterals.ts
|
|
110
|
+
// src/operations/scriptLiterals.ts
|
|
113
111
|
const JS_STRING_LITERALS_RE = /"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`/g;
|
|
114
112
|
const SCRIPT_CALL_EXPRESSION_RE = /\b[$a-z_][\w$]*\s*\((?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`|[^()"'`])*\)/gi;
|
|
115
113
|
const SCRIPT_CALL_OR_MODULE_RE = /\b(?:import|export)\b|\b[$a-z_][\w$]*\s*\(/i;
|
|
@@ -135,5 +133,4 @@ function collectScriptCallStringLiterals(code) {
|
|
|
135
133
|
function mayContainScriptCallOrModuleSyntax(code) {
|
|
136
134
|
return SCRIPT_CALL_OR_MODULE_RE.test(code);
|
|
137
135
|
}
|
|
138
|
-
//#endregion
|
|
139
136
|
export { BABEL_TS_MODULE_PARSER_OPTIONS, BABEL_TS_MODULE_PLUGINS, analyzeCompilerScriptsWithNative, analyzeNpmChunksWithNative, analyzeScript, analyzeScripts, babelAstEngine, collectComponentPropsFromCode, collectComponentPropsWithBabel, collectComponentPropsWithOxc, collectFeatureFlagsFromCode, collectFeatureFlagsWithBabel, collectFeatureFlagsWithNative, collectFeatureFlagsWithNativeBatch, collectFeatureFlagsWithOxc, collectIdentifiersFromExpression, collectIdentifiersFromExpressionWithOxc, collectJsxAutoComponentsFromCode, collectJsxAutoComponentsWithBabel, collectJsxAutoComponentsWithOxc, collectJsxImportedComponentsAndDefaultExportFromBabelAst, collectJsxTemplateTagsFromBabelExpression, collectJsxTemplateTagsFromOxc, collectLoopScopeAliases, collectOnPageScrollPerformanceWarnings, collectOnPageScrollWarningsWithBabel, collectOnPageScrollWarningsWithNative, collectOnPageScrollWarningsWithOxc, collectPageScrollInspection, collectPageScrollInspectionWithOxc, collectPatternBindingNames, collectRequireTokens, collectScriptCallStringLiterals, collectScriptSetupImportsFromCode, collectScriptSetupImportsWithBabel, collectScriptSetupImportsWithOxc, collectScriptStringLiterals, collectSetDataPickKeysFromTemplateCode, collectSetDataPickKeysWithBabel, collectSetDataPickKeysWithOxc, consumeNamedFeatureFlag, consumeNamespaceFeatureFlag, createJsxImportedComponent, createLineStartOffsets, createScriptSetupImport, createWarningPrefix, defaultIsDefineComponentSource, defaultResolveBabelComponentExpression, defaultResolveBabelRenderExpression, extractComponentProperties, extractPropertiesObject, extractTemplateExpressions, generate, getCallExpressionCalleeName, getDynamicImportLiteralToken, getJsxImportLocalName, getJsxImportedName, getJsxOxcStaticPropertyName, getLocationFromOffset, getMemberExpressionPropertyName, getObjectPropertyByKey, getOnPageScrollCallbackArgument, getOxcCallExpressionCalleeName, getOxcMemberExpressionPropertyName, getOxcStaticPropertyName, getRenderPropertyFromComponentOptions, getRequireAsyncLiteralToken, getRequireCallbackLiteralToken, getScriptSetupImportedName, getStaticPropertyName, getStaticRequireLiteralValue, getVisitorKeys, hasBindingInScopes, hasPlatformApiMemberExpression, hasStaticRequireCall, isJsxDefineComponentImportSpecifier, isOnPageScrollCallee, isOxcFunctionLike, isOxcOnPageScrollCallee, isPlatformApiIdentifier, isPlatformApiMemberExpression, isStaticPropertyName, isStaticRequireCall, mapConstructorName, mayContainComponentPropsShape, mayContainFeatureFlagHints, mayContainJsxAutoComponentEntry, mayContainPlatformApiAccess, mayContainPlatformApiIdentifierByText, mayContainRelevantScriptSetupImports, mayContainRequireCallByText, mayContainScriptCallOrModuleSyntax, mayContainStaticRequireLiteral, mergeComponentPropTypes, oxcAstEngine, parse, parseJsLike, parseJsLikeWithEngine, platformApiIdentifierList, platformApiIdentifiers, registerNamedFeatureFlagLocal, registerNamespaceFeatureFlagLocal, resolveOptionsObjectExpression, resolveOptionsObjectExpressionWithBabel, resolveOxcComponentExpression, resolveOxcRenderExpression, resolveRenderExpressionFromComponentOptions, resolveRenderableExpression, resolveTypeFromNode, toStaticObjectKey, traverse, unwrapOxcExpression, unwrapTypeScriptExpression };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import process from "node:process";
|
|
3
|
-
|
|
3
|
+
// src/native/compilerAnalysis.ts
|
|
4
4
|
function isUtf16Boundary(code, offset) {
|
|
5
5
|
const before = code.charCodeAt(offset - 1);
|
|
6
6
|
const after = code.charCodeAt(offset);
|
|
@@ -88,8 +88,7 @@ function readNativeCompilerScriptAnalysis(value, code) {
|
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
|
|
92
|
-
//#region src/native/npmChunks.ts
|
|
91
|
+
// src/native/npmChunks.ts
|
|
93
92
|
function record(value) {
|
|
94
93
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
95
94
|
}
|
|
@@ -195,8 +194,7 @@ function readNativeNpmChunkAnalysis(value, code) {
|
|
|
195
194
|
return;
|
|
196
195
|
}
|
|
197
196
|
}
|
|
198
|
-
|
|
199
|
-
//#region src/native/scriptAnalysis.ts
|
|
197
|
+
// src/native/scriptAnalysis.ts
|
|
200
198
|
/** 批次形状读取失败时进入同一校验失败分支,避免漏记或重复记录回退。 */
|
|
201
199
|
function isNativeScriptAnalysisBatchShape(value, expectedLength) {
|
|
202
200
|
try {
|
|
@@ -236,8 +234,7 @@ function readNativeScriptAnalysis(value) {
|
|
|
236
234
|
return;
|
|
237
235
|
}
|
|
238
236
|
}
|
|
239
|
-
|
|
240
|
-
//#region src/native.ts
|
|
237
|
+
// src/native.ts
|
|
241
238
|
const require = createRequire(import.meta.url);
|
|
242
239
|
let binding;
|
|
243
240
|
let lastScriptAnalysis;
|
|
@@ -358,5 +355,4 @@ function analyzeNpmChunksWithNative(inputs) {
|
|
|
358
355
|
}
|
|
359
356
|
});
|
|
360
357
|
}
|
|
361
|
-
//#endregion
|
|
362
358
|
export { loadNativeAstBindingSync as a, analyzeScriptsWithNative as i, analyzeNpmChunksWithNative as n, shouldUseNativeAst as o, analyzeScriptWithNative as r, analyzeCompilerScriptsWithNative as t };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { t as AstEngineName } from "./types-
|
|
1
|
+
import { t as AstEngineName } from "./types-urOiI-JL.mjs";
|
|
2
2
|
import * as t from "@babel/types";
|
|
3
|
-
//#region src/operations/onPageScroll/types.d.ts
|
|
4
3
|
interface PageScrollInspection {
|
|
5
4
|
empty: boolean;
|
|
6
5
|
hasSetDataCall: boolean;
|
|
@@ -10,23 +9,17 @@ interface OxcLoc {
|
|
|
10
9
|
line: number;
|
|
11
10
|
column: number;
|
|
12
11
|
}
|
|
13
|
-
//#endregion
|
|
14
|
-
//#region src/operations/onPageScroll/babel.d.ts
|
|
15
12
|
declare function collectPageScrollInspection(functionPath: any, node: t.ArrowFunctionExpression | t.FunctionExpression | t.ObjectMethod): PageScrollInspection;
|
|
16
13
|
declare function collectOnPageScrollWarningsWithBabel(code: string, filename: string): string[];
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/operations/onPageScroll/oxc.d.ts
|
|
19
14
|
declare function collectPageScrollInspectionWithOxc(node: any): PageScrollInspection;
|
|
20
15
|
declare function collectOnPageScrollWarningsWithOxc(code: string, filename: string): string[];
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/operations/onPageScroll/shared.d.ts
|
|
23
16
|
declare function isStaticPropertyName(key: t.Expression | t.Identifier | t.PrivateName): string | undefined;
|
|
24
17
|
declare function getMemberExpressionPropertyName(node: t.MemberExpression | t.OptionalMemberExpression): string | undefined;
|
|
25
18
|
declare function isOnPageScrollCallee(callee: t.Expression | t.V8IntrinsicIdentifier, hookNames: Set<string>, namespaceImports: Set<string>): boolean;
|
|
26
19
|
declare function getCallExpressionCalleeName(callee: t.Expression | t.V8IntrinsicIdentifier): string | undefined;
|
|
27
20
|
declare function getOnPageScrollCallbackArgument(node: {
|
|
28
21
|
arguments?: Array<t.Expression | t.SpreadElement | t.ArgumentPlaceholder | null>;
|
|
29
|
-
}): t.
|
|
22
|
+
}): t.FunctionExpression | t.ArrowFunctionExpression | undefined;
|
|
30
23
|
declare function createWarningPrefix(filename: string, line?: number, column?: number): string;
|
|
31
24
|
declare function getOxcStaticPropertyName(node: any): string | undefined;
|
|
32
25
|
declare function getOxcMemberExpressionPropertyName(node: any): string | undefined;
|
|
@@ -35,8 +28,6 @@ declare function isOxcOnPageScrollCallee(callee: any, hookNames: Set<string>, na
|
|
|
35
28
|
declare function getOxcCallExpressionCalleeName(callee: any): string | undefined;
|
|
36
29
|
declare function createLineStartOffsets(code: string): number[];
|
|
37
30
|
declare function getLocationFromOffset(offset: number | undefined, lineStarts: number[]): OxcLoc | undefined;
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region src/operations/onPageScroll/index.d.ts
|
|
40
31
|
declare function collectOnPageScrollWarningsWithNative(code: string, filename: string): string[] | undefined;
|
|
41
32
|
/**
|
|
42
33
|
* 静态检测 onPageScroll 中的常见性能风险并返回告警文案。
|
|
@@ -44,5 +35,4 @@ declare function collectOnPageScrollWarningsWithNative(code: string, filename: s
|
|
|
44
35
|
declare function collectOnPageScrollPerformanceWarnings(code: string, filename: string, options?: {
|
|
45
36
|
engine?: AstEngineName;
|
|
46
37
|
}): string[];
|
|
47
|
-
//#endregion
|
|
48
38
|
export { collectPageScrollInspectionWithOxc as _, getCallExpressionCalleeName as a, getOnPageScrollCallbackArgument as c, getOxcStaticPropertyName as d, isOnPageScrollCallee as f, collectOnPageScrollWarningsWithOxc as g, isStaticPropertyName as h, createWarningPrefix as i, getOxcCallExpressionCalleeName as l, isOxcOnPageScrollCallee as m, collectOnPageScrollWarningsWithNative as n, getLocationFromOffset as o, isOxcFunctionLike as p, createLineStartOffsets as r, getMemberExpressionPropertyName as s, collectOnPageScrollPerformanceWarnings as t, getOxcMemberExpressionPropertyName as u, collectOnPageScrollWarningsWithBabel as v, collectPageScrollInspection as y };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { parseJsLike, traverse } from "./babel.mjs";
|
|
2
|
-
import { t as parseJsLikeWithEngine } from "./engine-
|
|
3
|
-
import { a as loadNativeAstBindingSync, o as shouldUseNativeAst } from "./native-
|
|
2
|
+
import { t as parseJsLikeWithEngine } from "./engine-DNS4Kzzw.mjs";
|
|
3
|
+
import { a as loadNativeAstBindingSync, o as shouldUseNativeAst } from "./native-D8RHiEuF.mjs";
|
|
4
4
|
import { walk } from "oxc-walker";
|
|
5
|
-
|
|
5
|
+
// src/operations/onPageScroll/shared.ts
|
|
6
6
|
function isStaticPropertyName(key) {
|
|
7
7
|
if (key.type === "Identifier") return key.name;
|
|
8
8
|
if (key.type === "StringLiteral") return key.value;
|
|
@@ -79,8 +79,7 @@ function getLocationFromOffset(offset, lineStarts) {
|
|
|
79
79
|
column: offset - lineStarts[lineIndex] + 1
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
//#region src/operations/onPageScroll/babel.ts
|
|
82
|
+
// src/operations/onPageScroll/babel.ts
|
|
84
83
|
function collectPageScrollInspection(functionPath, node) {
|
|
85
84
|
const inspection = {
|
|
86
85
|
empty: node.body.type === "BlockStatement" && node.body.body.length === 0,
|
|
@@ -169,8 +168,7 @@ function collectOnPageScrollWarningsWithBabel(code, filename) {
|
|
|
169
168
|
});
|
|
170
169
|
return warnings;
|
|
171
170
|
}
|
|
172
|
-
|
|
173
|
-
//#region src/operations/onPageScroll/oxc.ts
|
|
171
|
+
// src/operations/onPageScroll/oxc.ts
|
|
174
172
|
function isOxcNestedFunctionBoundary(node) {
|
|
175
173
|
return isOxcFunctionLike(node) || node?.type === "FunctionDeclaration";
|
|
176
174
|
}
|
|
@@ -241,8 +239,7 @@ function collectOnPageScrollWarningsWithOxc(code, filename) {
|
|
|
241
239
|
} });
|
|
242
240
|
return warnings;
|
|
243
241
|
}
|
|
244
|
-
|
|
245
|
-
//#region src/operations/onPageScroll/index.ts
|
|
242
|
+
// src/operations/onPageScroll/index.ts
|
|
246
243
|
function formatNativeOnPageScrollWarning(diagnostic, filename) {
|
|
247
244
|
const prefix = createWarningPrefix(filename, diagnostic.line, diagnostic.column);
|
|
248
245
|
if (diagnostic.kind === "empty") return `${prefix} 检测到空的 ${diagnostic.sourceLabel} 回调,建议移除无效监听以降低滚动时调度开销。`;
|
|
@@ -282,5 +279,4 @@ function collectOnPageScrollPerformanceWarnings(code, filename, options) {
|
|
|
282
279
|
return [];
|
|
283
280
|
}
|
|
284
281
|
}
|
|
285
|
-
//#endregion
|
|
286
282
|
export { isOxcFunctionLike as _, collectOnPageScrollWarningsWithBabel as a, createWarningPrefix as c, getMemberExpressionPropertyName as d, getOnPageScrollCallbackArgument as f, isOnPageScrollCallee as g, getOxcStaticPropertyName as h, collectPageScrollInspectionWithOxc as i, getCallExpressionCalleeName as l, getOxcMemberExpressionPropertyName as m, collectOnPageScrollWarningsWithNative as n, collectPageScrollInspection as o, getOxcCallExpressionCalleeName as p, collectOnPageScrollWarningsWithOxc as r, createLineStartOffsets as s, collectOnPageScrollPerformanceWarnings as t, getLocationFromOffset as u, isOxcOnPageScrollCallee as v, isStaticPropertyName as y };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { t as AstEngineName } from "../types-
|
|
1
|
+
import { t as AstEngineName } from "../types-urOiI-JL.mjs";
|
|
2
2
|
import * as t from "@babel/types";
|
|
3
3
|
import { NodePath } from "@babel/traverse";
|
|
4
|
-
//#region src/operations/componentProps.d.ts
|
|
5
4
|
export type ComponentPropMap = Map<string, string>;
|
|
6
5
|
export declare function mayContainComponentPropsShape(code: string): boolean;
|
|
7
6
|
export declare function mapConstructorName(name: string): string;
|
|
@@ -19,5 +18,4 @@ export declare function collectComponentPropsWithOxc(code: string): ComponentPro
|
|
|
19
18
|
*/
|
|
20
19
|
export declare function collectComponentPropsFromCode(code: string, options?: {
|
|
21
20
|
astEngine?: AstEngineName;
|
|
22
|
-
}): ComponentPropMap;
|
|
23
|
-
//#endregion
|
|
21
|
+
}): ComponentPropMap;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BABEL_TS_MODULE_PARSER_OPTIONS, parse, traverse } from "../babel.mjs";
|
|
2
|
-
import { t as parseJsLikeWithEngine } from "../engine-
|
|
2
|
+
import { t as parseJsLikeWithEngine } from "../engine-DNS4Kzzw.mjs";
|
|
3
3
|
import { walk } from "oxc-walker";
|
|
4
|
-
|
|
4
|
+
// src/operations/componentProps.ts
|
|
5
5
|
const COMPONENT_PROPS_TEXT_HINTS = ["properties", "props"];
|
|
6
6
|
const COMPONENT_OPTIONS_CALL_HINT_RE = /\b[a-z_$][\w$]*(?:\s*<[^(){};]+>)?\s*(?:\?\.\s*)?\(/i;
|
|
7
7
|
function mayContainComponentPropsShape(code) {
|
|
@@ -183,5 +183,4 @@ function collectComponentPropsFromCode(code, options) {
|
|
|
183
183
|
return /* @__PURE__ */ new Map();
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
//#endregion
|
|
187
186
|
export { collectComponentPropsFromCode, collectComponentPropsWithBabel, collectComponentPropsWithOxc, extractComponentProperties, extractPropertiesObject, getStaticPropertyName, mapConstructorName, mayContainComponentPropsShape, mergeComponentPropTypes, resolveOptionsObjectExpression, resolveOptionsObjectExpressionWithBabel, resolveTypeFromNode };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { t as AstEngineName } from "../types-
|
|
2
|
-
//#region src/operations/featureFlags.d.ts
|
|
1
|
+
import { t as AstEngineName } from "../types-urOiI-JL.mjs";
|
|
3
2
|
export interface FeatureFlagOptions<TFeature extends string> {
|
|
4
3
|
astEngine?: AstEngineName;
|
|
5
4
|
moduleId: string;
|
|
@@ -17,5 +16,4 @@ export declare function collectFeatureFlagsWithNativeBatch<TFeature extends stri
|
|
|
17
16
|
/**
|
|
18
17
|
* 根据模块 ID 与 hook 映射表,从源码中收集启用的特性标识。
|
|
19
18
|
*/
|
|
20
|
-
export declare function collectFeatureFlagsFromCode<TFeature extends string>(code: string, options: FeatureFlagOptions<TFeature>): Set<TFeature>;
|
|
21
|
-
//#endregion
|
|
19
|
+
export declare function collectFeatureFlagsFromCode<TFeature extends string>(code: string, options: FeatureFlagOptions<TFeature>): Set<TFeature>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { parseJsLike, traverse } from "../babel.mjs";
|
|
2
|
-
import { t as parseJsLikeWithEngine } from "../engine-
|
|
3
|
-
import { a as loadNativeAstBindingSync, o as shouldUseNativeAst, r as analyzeScriptWithNative } from "../native-
|
|
2
|
+
import { t as parseJsLikeWithEngine } from "../engine-DNS4Kzzw.mjs";
|
|
3
|
+
import { a as loadNativeAstBindingSync, o as shouldUseNativeAst, r as analyzeScriptWithNative } from "../native-D8RHiEuF.mjs";
|
|
4
4
|
import * as t from "@babel/types";
|
|
5
5
|
import { walk } from "oxc-walker";
|
|
6
|
-
|
|
6
|
+
// src/operations/featureFlags.ts
|
|
7
7
|
const CALL_EXPRESSION_TEXT_RE = /\b[a-z_$][\w$]*(?:\s*<[^(){};]+>)?\s*(?:\?\.\s*)?\(/i;
|
|
8
8
|
function mayContainFeatureFlagHints(code, moduleId, hookToFeature) {
|
|
9
9
|
if (!code.includes(moduleId)) return false;
|
|
@@ -123,5 +123,4 @@ function collectFeatureFlagsFromCode(code, options) {
|
|
|
123
123
|
return /* @__PURE__ */ new Set();
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
//#endregion
|
|
127
126
|
export { collectFeatureFlagsFromCode, collectFeatureFlagsWithBabel, collectFeatureFlagsWithNative, collectFeatureFlagsWithNativeBatch, collectFeatureFlagsWithOxc, consumeNamedFeatureFlag, consumeNamespaceFeatureFlag, mayContainFeatureFlagHints, registerNamedFeatureFlagLocal, registerNamespaceFeatureFlagLocal };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { t as AstEngineName } from "../types-
|
|
1
|
+
import { t as AstEngineName } from "../types-urOiI-JL.mjs";
|
|
2
2
|
import * as t from "@babel/types";
|
|
3
3
|
import { Expression, ObjectExpression } from "@babel/types";
|
|
4
|
-
//#region src/operations/jsxAutoComponents/types.d.ts
|
|
5
4
|
export interface JsxImportedComponent {
|
|
6
5
|
localName: string;
|
|
7
6
|
importSource: string;
|
|
@@ -23,8 +22,6 @@ export interface JsxBabelModuleAnalysisOptions {
|
|
|
23
22
|
isDefineComponentSource?: (source: string) => boolean;
|
|
24
23
|
resolveBabelComponentExpression?: (declaration: t.Declaration | t.Expression | null, defineComponentDecls: Map<string, ObjectExpression>, defineComponentAliases: Set<string>) => Expression | null;
|
|
25
24
|
}
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/operations/jsxAutoComponents/babel.d.ts
|
|
28
25
|
export declare function defaultResolveBabelComponentExpression(declaration: t.Declaration | t.Expression | null, defineComponentDecls: Map<string, ObjectExpression>, defineComponentAliases: Set<string>): Expression | null;
|
|
29
26
|
export declare function defaultResolveBabelRenderExpression(componentExpr: Expression): Expression | null;
|
|
30
27
|
export declare function collectJsxImportedComponentsAndDefaultExportFromBabelAst(ast: t.File, options?: JsxBabelModuleAnalysisOptions): {
|
|
@@ -33,26 +30,19 @@ export declare function collectJsxImportedComponentsAndDefaultExportFromBabelAst
|
|
|
33
30
|
};
|
|
34
31
|
export declare function collectJsxTemplateTagsFromBabelExpression(renderExpression: Expression, isCollectableTag: (tag: string) => boolean): Set<string>;
|
|
35
32
|
export declare function collectJsxAutoComponentsWithBabel(source: string, options: Required<JsxAutoComponentAnalysisOptions>): JsxAutoComponentContext;
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region src/operations/jsxAutoComponents/oxc.d.ts
|
|
38
33
|
export declare function unwrapOxcExpression(node: any): any;
|
|
39
34
|
export declare function getJsxOxcStaticPropertyName(node: any): any;
|
|
40
35
|
export declare function resolveOxcComponentExpression(declaration: any, defineComponentDecls: Map<string, any>, defineComponentAliases: Set<string>): any;
|
|
41
36
|
export declare function resolveOxcRenderExpression(componentExpr: any): any;
|
|
42
37
|
export declare function collectJsxTemplateTagsFromOxc(renderExpression: any, isCollectableTag: (tag: string) => boolean): Set<string>;
|
|
43
38
|
export declare function collectJsxAutoComponentsWithOxc(source: string, options: Required<Pick<JsxAutoComponentAnalysisOptions, 'isCollectableTag' | 'isDefineComponentSource'>>): JsxAutoComponentContext;
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region src/operations/jsxAutoComponents/shared.d.ts
|
|
46
39
|
export declare function mayContainJsxAutoComponentEntry(source: string): boolean;
|
|
47
40
|
export declare function defaultIsDefineComponentSource(source: string): source is "vue";
|
|
48
41
|
export declare function getJsxImportedName(imported: any): any;
|
|
49
42
|
export declare function createJsxImportedComponent(localName: string, importSource: string, kind: JsxImportedComponent['kind'], imported?: any): JsxImportedComponent;
|
|
50
43
|
export declare function getJsxImportLocalName(specifier: any): any;
|
|
51
44
|
export declare function isJsxDefineComponentImportSpecifier(specifier: any): boolean;
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region src/operations/jsxAutoComponents/index.d.ts
|
|
54
45
|
/**
|
|
55
46
|
* 从 JSX 源码中收集自动 usingComponents 所需的导入组件与模板标签。
|
|
56
47
|
*/
|
|
57
|
-
export declare function collectJsxAutoComponentsFromCode(source: string, options: JsxAutoComponentAnalysisOptions): JsxAutoComponentContext;
|
|
58
|
-
//#endregion
|
|
48
|
+
export declare function collectJsxAutoComponentsFromCode(source: string, options: JsxAutoComponentAnalysisOptions): JsxAutoComponentContext;
|
|
@@ -3,7 +3,7 @@ import { getObjectPropertyByKey, resolveRenderableExpression } from "../babelNod
|
|
|
3
3
|
import * as t from "@babel/types";
|
|
4
4
|
import { parseSync } from "oxc-parser";
|
|
5
5
|
import { walk } from "oxc-walker";
|
|
6
|
-
|
|
6
|
+
// src/operations/jsxAutoComponents/shared.ts
|
|
7
7
|
function mayContainJsxAutoComponentEntry(source) {
|
|
8
8
|
return source.includes("import") || source.includes("export default");
|
|
9
9
|
}
|
|
@@ -28,8 +28,7 @@ function getJsxImportLocalName(specifier) {
|
|
|
28
28
|
function isJsxDefineComponentImportSpecifier(specifier) {
|
|
29
29
|
return t.isImportSpecifier(specifier) ? t.isIdentifier(specifier.imported, { name: "defineComponent" }) : specifier?.type === "ImportSpecifier" && specifier.imported?.type === "Identifier" && specifier.imported.name === "defineComponent";
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
//#region src/operations/jsxAutoComponents/babel.ts
|
|
31
|
+
// src/operations/jsxAutoComponents/babel.ts
|
|
33
32
|
function defaultResolveBabelComponentExpression(declaration, defineComponentDecls, defineComponentAliases) {
|
|
34
33
|
if (!declaration) return null;
|
|
35
34
|
if (t.isObjectExpression(declaration)) return declaration;
|
|
@@ -171,8 +170,7 @@ function collectJsxAutoComponentsWithBabel(source, options) {
|
|
|
171
170
|
importedComponents
|
|
172
171
|
};
|
|
173
172
|
}
|
|
174
|
-
|
|
175
|
-
//#region src/operations/jsxAutoComponents/oxc.ts
|
|
173
|
+
// src/operations/jsxAutoComponents/oxc.ts
|
|
176
174
|
function unwrapOxcExpression(node) {
|
|
177
175
|
let current = node;
|
|
178
176
|
while (current && (current.type === "TSAsExpression" || current.type === "TSSatisfiesExpression" || current.type === "TSNonNullExpression" || current.type === "ParenthesizedExpression")) current = current.expression;
|
|
@@ -289,8 +287,7 @@ function collectJsxAutoComponentsWithOxc(source, options) {
|
|
|
289
287
|
importedComponents
|
|
290
288
|
};
|
|
291
289
|
}
|
|
292
|
-
|
|
293
|
-
//#region src/operations/jsxAutoComponents/index.ts
|
|
290
|
+
// src/operations/jsxAutoComponents/index.ts
|
|
294
291
|
/**
|
|
295
292
|
* 从 JSX 源码中收集自动 usingComponents 所需的导入组件与模板标签。
|
|
296
293
|
*/
|
|
@@ -315,5 +312,4 @@ function collectJsxAutoComponentsFromCode(source, options) {
|
|
|
315
312
|
};
|
|
316
313
|
}
|
|
317
314
|
}
|
|
318
|
-
//#endregion
|
|
319
315
|
export { collectJsxAutoComponentsFromCode, collectJsxAutoComponentsWithBabel, collectJsxAutoComponentsWithOxc, collectJsxImportedComponentsAndDefaultExportFromBabelAst, collectJsxTemplateTagsFromBabelExpression, collectJsxTemplateTagsFromOxc, createJsxImportedComponent, defaultIsDefineComponentSource, defaultResolveBabelComponentExpression, defaultResolveBabelRenderExpression, getJsxImportLocalName, getJsxImportedName, getJsxOxcStaticPropertyName, isJsxDefineComponentImportSpecifier, mayContainJsxAutoComponentEntry, resolveOxcComponentExpression, resolveOxcRenderExpression, unwrapOxcExpression };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as collectPageScrollInspectionWithOxc, a as getCallExpressionCalleeName, c as getOnPageScrollCallbackArgument, d as getOxcStaticPropertyName, f as isOnPageScrollCallee, g as collectOnPageScrollWarningsWithOxc, h as isStaticPropertyName, i as createWarningPrefix, l as getOxcCallExpressionCalleeName, m as isOxcOnPageScrollCallee, n as collectOnPageScrollWarningsWithNative, o as getLocationFromOffset, p as isOxcFunctionLike, r as createLineStartOffsets, s as getMemberExpressionPropertyName, t as collectOnPageScrollPerformanceWarnings, u as getOxcMemberExpressionPropertyName, v as collectOnPageScrollWarningsWithBabel, y as collectPageScrollInspection } from "../onPageScroll-
|
|
1
|
+
import { _ as collectPageScrollInspectionWithOxc, a as getCallExpressionCalleeName, c as getOnPageScrollCallbackArgument, d as getOxcStaticPropertyName, f as isOnPageScrollCallee, g as collectOnPageScrollWarningsWithOxc, h as isStaticPropertyName, i as createWarningPrefix, l as getOxcCallExpressionCalleeName, m as isOxcOnPageScrollCallee, n as collectOnPageScrollWarningsWithNative, o as getLocationFromOffset, p as isOxcFunctionLike, r as createLineStartOffsets, s as getMemberExpressionPropertyName, t as collectOnPageScrollPerformanceWarnings, u as getOxcMemberExpressionPropertyName, v as collectOnPageScrollWarningsWithBabel, y as collectPageScrollInspection } from "../onPageScroll-9kwtAWzG.mjs";
|
|
2
2
|
export { collectOnPageScrollPerformanceWarnings, collectOnPageScrollWarningsWithBabel, collectOnPageScrollWarningsWithNative, collectOnPageScrollWarningsWithOxc, collectPageScrollInspection, collectPageScrollInspectionWithOxc, createLineStartOffsets, createWarningPrefix, getCallExpressionCalleeName, getLocationFromOffset, getMemberExpressionPropertyName, getOnPageScrollCallbackArgument, getOxcCallExpressionCalleeName, getOxcMemberExpressionPropertyName, getOxcStaticPropertyName, isOnPageScrollCallee, isOxcFunctionLike, isOxcOnPageScrollCallee, isStaticPropertyName };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as collectOnPageScrollPerformanceWarnings, a as collectOnPageScrollWarningsWithBabel, n as collectOnPageScrollWarningsWithNative, r as collectOnPageScrollWarningsWithOxc, o as collectPageScrollInspection, i as collectPageScrollInspectionWithOxc, s as createLineStartOffsets, c as createWarningPrefix, l as getCallExpressionCalleeName, u as getLocationFromOffset, d as getMemberExpressionPropertyName, f as getOnPageScrollCallbackArgument, p as getOxcCallExpressionCalleeName, m as getOxcMemberExpressionPropertyName, h as getOxcStaticPropertyName, g as isOnPageScrollCallee, _ as isOxcFunctionLike, v as isOxcOnPageScrollCallee, y as isStaticPropertyName } from "../onPageScroll-
|
|
1
|
+
export { t as collectOnPageScrollPerformanceWarnings, a as collectOnPageScrollWarningsWithBabel, n as collectOnPageScrollWarningsWithNative, r as collectOnPageScrollWarningsWithOxc, o as collectPageScrollInspection, i as collectPageScrollInspectionWithOxc, s as createLineStartOffsets, c as createWarningPrefix, l as getCallExpressionCalleeName, u as getLocationFromOffset, d as getMemberExpressionPropertyName, f as getOnPageScrollCallbackArgument, p as getOxcCallExpressionCalleeName, m as getOxcMemberExpressionPropertyName, h as getOxcStaticPropertyName, g as isOnPageScrollCallee, _ as isOxcFunctionLike, v as isOxcOnPageScrollCallee, y as isStaticPropertyName } from "../onPageScroll-CN_ocv9l.mjs";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { n as AstParserLike, t as AstEngineName } from "../types-
|
|
1
|
+
import { n as AstParserLike, t as AstEngineName } from "../types-urOiI-JL.mjs";
|
|
2
2
|
import { Program } from "@oxc-project/types";
|
|
3
|
-
//#region src/operations/platformApi.d.ts
|
|
4
3
|
export declare const platformApiIdentifierList: readonly ["wx", "my", "tt", "swan", "jd", "xhs"];
|
|
5
4
|
export declare const platformApiIdentifiers: Set<"wx" | "my" | "tt" | "swan" | "jd" | "xhs">;
|
|
6
5
|
export declare function isPlatformApiIdentifier(name: string): boolean;
|
|
@@ -13,5 +12,4 @@ export declare function hasPlatformApiMemberExpression(ast: Program): boolean;
|
|
|
13
12
|
export declare function mayContainPlatformApiAccess(code: string, options?: {
|
|
14
13
|
engine?: AstEngineName;
|
|
15
14
|
parserLike?: AstParserLike;
|
|
16
|
-
}): boolean;
|
|
17
|
-
//#endregion
|
|
15
|
+
}): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as parseJsLikeWithEngine } from "../engine-
|
|
2
|
-
import { a as loadNativeAstBindingSync, o as shouldUseNativeAst, r as analyzeScriptWithNative } from "../native-
|
|
1
|
+
import { t as parseJsLikeWithEngine } from "../engine-DNS4Kzzw.mjs";
|
|
2
|
+
import { a as loadNativeAstBindingSync, o as shouldUseNativeAst, r as analyzeScriptWithNative } from "../native-D8RHiEuF.mjs";
|
|
3
3
|
import { walk } from "oxc-walker";
|
|
4
|
-
|
|
4
|
+
// src/operations/platformApi.ts
|
|
5
5
|
const platformApiIdentifierList = [
|
|
6
6
|
"wx",
|
|
7
7
|
"my",
|
|
@@ -52,5 +52,4 @@ function mayContainPlatformApiAccess(code, options) {
|
|
|
52
52
|
return true;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
//#endregion
|
|
56
55
|
export { hasPlatformApiMemberExpression, isPlatformApiIdentifier, isPlatformApiMemberExpression, mayContainPlatformApiAccess, mayContainPlatformApiIdentifierByText, platformApiIdentifierList, platformApiIdentifiers };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { n as AstParserLike, t as AstEngineName } from "../types-
|
|
1
|
+
import { n as AstParserLike, t as AstEngineName } from "../types-urOiI-JL.mjs";
|
|
2
2
|
import { Program } from "@oxc-project/types";
|
|
3
|
-
//#region src/operations/require.d.ts
|
|
4
3
|
export interface RequireToken {
|
|
5
4
|
start: number;
|
|
6
5
|
end: number;
|
|
@@ -49,5 +48,4 @@ export declare function hasStaticRequireCall(ast: Program): boolean;
|
|
|
49
48
|
export declare function mayContainStaticRequireLiteral(code: string, options?: {
|
|
50
49
|
engine?: AstEngineName;
|
|
51
50
|
parserLike?: AstParserLike;
|
|
52
|
-
}): boolean;
|
|
53
|
-
//#endregion
|
|
51
|
+
}): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as parseJsLikeWithEngine } from "../engine-
|
|
2
|
-
import { a as loadNativeAstBindingSync, o as shouldUseNativeAst, r as analyzeScriptWithNative } from "../native-
|
|
1
|
+
import { t as parseJsLikeWithEngine } from "../engine-DNS4Kzzw.mjs";
|
|
2
|
+
import { a as loadNativeAstBindingSync, o as shouldUseNativeAst, r as analyzeScriptWithNative } from "../native-D8RHiEuF.mjs";
|
|
3
3
|
import { walk } from "oxc-walker";
|
|
4
|
-
|
|
4
|
+
// src/operations/require.ts
|
|
5
5
|
function mayContainRequireCallByText(code) {
|
|
6
6
|
return code.includes("require(") || code.includes("require (") || code.includes("require`");
|
|
7
7
|
}
|
|
@@ -128,5 +128,4 @@ function mayContainStaticRequireLiteral(code, options) {
|
|
|
128
128
|
return true;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
//#endregion
|
|
132
131
|
export { collectRequireTokens, getDynamicImportLiteralToken, getRequireAsyncLiteralToken, getRequireCallbackLiteralToken, getStaticRequireLiteralValue, hasStaticRequireCall, isStaticRequireCall, mayContainRequireCallByText, mayContainStaticRequireLiteral };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { t as AstEngineName } from "../types-
|
|
2
|
-
//#region src/operations/scriptSetupImports.d.ts
|
|
1
|
+
import { t as AstEngineName } from "../types-urOiI-JL.mjs";
|
|
3
2
|
export interface ScriptSetupImport {
|
|
4
3
|
localName: string;
|
|
5
4
|
importSource: string;
|
|
@@ -16,5 +15,4 @@ export declare function collectScriptSetupImportsWithBabel(scriptSetup: string,
|
|
|
16
15
|
*/
|
|
17
16
|
export declare function collectScriptSetupImportsFromCode(scriptSetup: string, templateComponentNames: Set<string>, options?: {
|
|
18
17
|
astEngine?: AstEngineName;
|
|
19
|
-
}): ScriptSetupImport[];
|
|
20
|
-
//#endregion
|
|
18
|
+
}): ScriptSetupImport[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BABEL_TS_MODULE_PARSER_OPTIONS, parse } from "../babel.mjs";
|
|
2
|
-
import { t as parseJsLikeWithEngine } from "../engine-
|
|
3
|
-
|
|
2
|
+
import { t as parseJsLikeWithEngine } from "../engine-DNS4Kzzw.mjs";
|
|
3
|
+
// src/operations/scriptSetupImports.ts
|
|
4
4
|
function mayContainRelevantScriptSetupImports(scriptSetup, templateComponentNames) {
|
|
5
5
|
if (templateComponentNames.size === 0) return false;
|
|
6
6
|
if (!scriptSetup.includes("import")) return false;
|
|
@@ -67,5 +67,4 @@ function collectScriptSetupImportsFromCode(scriptSetup, templateComponentNames,
|
|
|
67
67
|
return [];
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
//#endregion
|
|
71
70
|
export { collectScriptSetupImportsFromCode, collectScriptSetupImportsWithBabel, collectScriptSetupImportsWithOxc, createScriptSetupImport, getScriptSetupImportedName, mayContainRelevantScriptSetupImports };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { t as AstEngineName } from "../types-
|
|
2
|
-
//#region src/operations/setDataPick.d.ts
|
|
1
|
+
import { t as AstEngineName } from "../types-urOiI-JL.mjs";
|
|
3
2
|
export declare function collectLoopScopeAliases(template: string): Set<string>;
|
|
4
3
|
export declare function extractTemplateExpressions(template: string): string[];
|
|
5
4
|
export declare function collectIdentifiersFromExpression(expression: string): Set<string>;
|
|
@@ -15,5 +14,4 @@ export declare function collectSetDataPickKeysWithOxc(template: string): string[
|
|
|
15
14
|
*/
|
|
16
15
|
export declare function collectSetDataPickKeysFromTemplateCode(template: string, options?: {
|
|
17
16
|
astEngine?: AstEngineName;
|
|
18
|
-
}): string[];
|
|
19
|
-
//#endregion
|
|
17
|
+
}): string[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BABEL_TS_MODULE_PARSER_OPTIONS, parse, traverse } from "../babel.mjs";
|
|
2
|
-
import { t as parseJsLikeWithEngine } from "../engine-
|
|
2
|
+
import { t as parseJsLikeWithEngine } from "../engine-DNS4Kzzw.mjs";
|
|
3
3
|
import { getMiniProgramDirectivePrefix, getSupportedMiniProgramPlatforms } from "@weapp-core/shared";
|
|
4
|
-
|
|
4
|
+
// src/operations/setDataPick.ts
|
|
5
5
|
const TEMPLATE_MUSTACHE_RE = /\{\{([\s\S]*?)\}\}/g;
|
|
6
6
|
const FOR_DIRECTIVE_PREFIX_PATTERN = Array.from(/* @__PURE__ */ new Set(["s", ...getSupportedMiniProgramPlatforms().map((platform) => getMiniProgramDirectivePrefix(platform))])).sort((left, right) => right.length - left.length).map((prefix) => prefix.replace(/[|\\{}()[\]^$+*?.-]/g, "\\$&")).join("|");
|
|
7
7
|
const FOR_DIRECTIVE_SEPARATOR_PATTERN = "[:-]";
|
|
@@ -285,5 +285,4 @@ function collectSetDataPickKeysFromTemplateCode(template, options) {
|
|
|
285
285
|
return [];
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
-
//#endregion
|
|
289
288
|
export { collectIdentifiersFromExpression, collectIdentifiersFromExpressionWithOxc, collectLoopScopeAliases, collectPatternBindingNames, collectSetDataPickKeysFromTemplateCode, collectSetDataPickKeysWithBabel, collectSetDataPickKeysWithOxc, extractTemplateExpressions, hasBindingInScopes };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/types.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* AST 引擎名称。
|
|
4
3
|
*/
|
|
@@ -20,5 +19,4 @@ interface WeappAstConfig {
|
|
|
20
19
|
interface AstParserLike {
|
|
21
20
|
parse?: (input: string, options?: unknown) => unknown;
|
|
22
21
|
}
|
|
23
|
-
//#endregion
|
|
24
22
|
export { AstParserLike as n, WeappAstConfig as r, AstEngineName as t };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as AstParserLike, r as WeappAstConfig, t as AstEngineName } from "./types-
|
|
1
|
+
import { n as AstParserLike, r as WeappAstConfig, t as AstEngineName } from "./types-urOiI-JL.mjs";
|
|
2
2
|
export { AstEngineName, AstParserLike, WeappAstConfig };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-vite/ast",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.7.0",
|
|
5
5
|
"description": "weapp-vite 共享 AST 分析工具包,统一 Babel/Oxc 解析与常用分析操作",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -107,17 +107,17 @@
|
|
|
107
107
|
"dist"
|
|
108
108
|
],
|
|
109
109
|
"engines": {
|
|
110
|
-
"node": "^22.
|
|
110
|
+
"node": "^22.23.4 || ^24.22.1 || >=26.12.1"
|
|
111
111
|
},
|
|
112
112
|
"dependencies": {
|
|
113
|
-
"@babel/core": "^8.0.
|
|
113
|
+
"@babel/core": "^8.0.9",
|
|
114
114
|
"@babel/generator": "^8.0.6",
|
|
115
|
-
"@babel/parser": "^8.0.
|
|
115
|
+
"@babel/parser": "^8.0.8",
|
|
116
116
|
"@babel/traverse": "^8.0.7",
|
|
117
|
-
"@babel/types": "^8.0.
|
|
118
|
-
"@oxc-project/types": "^0.
|
|
119
|
-
"@weapp-core/shared": "3.
|
|
120
|
-
"oxc-parser": "^0.
|
|
117
|
+
"@babel/types": "^8.0.8",
|
|
118
|
+
"@oxc-project/types": "^0.155.0",
|
|
119
|
+
"@weapp-core/shared": "3.4.0",
|
|
120
|
+
"oxc-parser": "^0.155.0",
|
|
121
121
|
"oxc-walker": "^1.1.1"
|
|
122
122
|
},
|
|
123
123
|
"tsd": {
|