@weapp-vite/ast 7.13.0-dev.20261127.1 → 7.13.0-dev.20261129.1
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 +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{native-5s1fk2vp.mjs → native-DjEAh5_8.mjs} +1 -2
- package/dist/{onPageScroll-BaCgcYOW.mjs → onPageScroll-DNiSfKu0.mjs} +3 -4
- package/dist/operations/componentProps.d.mts +2 -2
- package/dist/operations/componentProps.mjs +1 -1
- package/dist/operations/featureFlags.mjs +3 -3
- package/dist/operations/jsxAutoComponents.d.mts +1 -1
- package/dist/operations/jsxAutoComponents.mjs +2 -3
- package/dist/operations/onPageScroll.mjs +1 -1
- package/dist/operations/platformApi.d.mts +1 -1
- package/dist/operations/platformApi.mjs +2 -2
- package/dist/operations/require.d.mts +1 -1
- package/dist/operations/require.mjs +2 -2
- package/dist/operations/scriptSetupImports.mjs +1 -1
- package/dist/operations/setDataPick.mjs +1 -1
- package/package.json +5 -5
package/dist/babel.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as t from "@babel/types";
|
|
2
1
|
import { ParserOptions, ParserPlugin } from "@babel/parser";
|
|
2
|
+
import * as t from "@babel/types";
|
|
3
3
|
export declare const BABEL_TS_MODULE_PLUGINS: ParserPlugin[];
|
|
4
4
|
export declare const BABEL_TS_MODULE_PARSER_OPTIONS: ParserOptions;
|
|
5
5
|
type BabelTraverse = typeof import('@babel/traverse').default;
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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
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-
|
|
4
|
+
import { i as analyzeScriptsWithNative, n as analyzeNpmChunksWithNative, o as shouldUseNativeAst, r as analyzeScriptWithNative, t as analyzeCompilerScriptsWithNative } from "./native-DjEAh5_8.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-DNiSfKu0.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 { analyzeScriptSetupImportsFromCode, collectScriptSetupImportsFromCode, collectScriptSetupImportsWithBabel, collectScriptSetupImportsWithOxc, createScriptSetupImport, getScriptSetupImportedName, mayContainRelevantScriptSetupImports } from "./operations/scriptSetupImports.mjs";
|
|
@@ -356,8 +356,7 @@ function analyzeCompilerScriptsWithNative(inputs) {
|
|
|
356
356
|
if (!Array.isArray(results) || results.length !== inputs.length) return inputs.map(fallback);
|
|
357
357
|
return inputs.map((input, index) => {
|
|
358
358
|
try {
|
|
359
|
-
|
|
360
|
-
return readNativeCompilerScriptAnalysis(result, input.code) ?? fallback();
|
|
359
|
+
return readNativeCompilerScriptAnalysis(results[index], input.code) ?? fallback();
|
|
361
360
|
} catch {
|
|
362
361
|
return fallback();
|
|
363
362
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as loadNativeAstBindingSync, o as shouldUseNativeAst } from "./native-
|
|
1
|
+
import { a as loadNativeAstBindingSync, o as shouldUseNativeAst } from "./native-DjEAh5_8.mjs";
|
|
2
2
|
import { parseJsLike, traverse } from "./babel.mjs";
|
|
3
|
-
import { t as parseJsLikeWithEngine } from "./engine-DNS4Kzzw.mjs";
|
|
4
3
|
import { walk } from "oxc-walker";
|
|
4
|
+
import { t as parseJsLikeWithEngine } from "./engine-DNS4Kzzw.mjs";
|
|
5
5
|
// src/operations/onPageScroll/shared.ts
|
|
6
6
|
function isStaticPropertyName(key) {
|
|
7
7
|
if (key.type === "Identifier") return key.name;
|
|
@@ -135,8 +135,7 @@ function collectOnPageScrollWarningsWithBabel(code, filename) {
|
|
|
135
135
|
};
|
|
136
136
|
const reportInspection = (functionPath, node, sourceLabel) => {
|
|
137
137
|
const inspection = collectPageScrollInspection(functionPath, node);
|
|
138
|
-
const
|
|
139
|
-
const prefix = createWarningPrefix(filename, line, typeof node.loc?.start.column === "number" ? node.loc.start.column + 1 : void 0);
|
|
138
|
+
const prefix = createWarningPrefix(filename, node.loc?.start.line, typeof node.loc?.start.column === "number" ? node.loc.start.column + 1 : void 0);
|
|
140
139
|
if (inspection.empty) addWarning(`${prefix} 检测到空的 ${sourceLabel} 回调,建议移除无效监听以降低滚动时调度开销。`);
|
|
141
140
|
if (inspection.hasSetDataCall) addWarning(`${prefix} 检测到 ${sourceLabel} 内调用 setData,建议改用节流、IntersectionObserver 或合并更新。`);
|
|
142
141
|
for (const syncApi of inspection.syncApis) addWarning(`${prefix} 检测到 ${sourceLabel} 内调用同步 API(${syncApi}),可能阻塞渲染线程。`);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as AstEngineName } from "../types-urOiI-JL.mjs";
|
|
2
|
-
import * as t from "@babel/types";
|
|
3
1
|
import { NodePath } from "@babel/traverse";
|
|
2
|
+
import * as t from "@babel/types";
|
|
3
|
+
import { t as AstEngineName } from "../types-urOiI-JL.mjs";
|
|
4
4
|
export type ComponentPropMap = Map<string, string>;
|
|
5
5
|
export declare function mayContainComponentPropsShape(code: string): boolean;
|
|
6
6
|
export declare function mapConstructorName(name: string): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { walk } from "oxc-walker";
|
|
1
2
|
import { BABEL_TS_MODULE_PARSER_OPTIONS, parse, traverse } from "../babel.mjs";
|
|
2
3
|
import { t as parseJsLikeWithEngine } from "../engine-DNS4Kzzw.mjs";
|
|
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;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { parseJsLike, traverse } from "../babel.mjs";
|
|
2
|
-
import { t as parseJsLikeWithEngine } from "../engine-DNS4Kzzw.mjs";
|
|
3
|
-
import { a as loadNativeAstBindingSync, o as shouldUseNativeAst, r as analyzeScriptWithNative } from "../native-5s1fk2vp.mjs";
|
|
4
1
|
import * as t from "@babel/types";
|
|
5
2
|
import { walk } from "oxc-walker";
|
|
3
|
+
import { parseJsLike, traverse } from "../babel.mjs";
|
|
4
|
+
import { t as parseJsLikeWithEngine } from "../engine-DNS4Kzzw.mjs";
|
|
5
|
+
import { a as loadNativeAstBindingSync, o as shouldUseNativeAst, r as analyzeScriptWithNative } from "../native-DjEAh5_8.mjs";
|
|
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) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as AstEngineName } from "../types-urOiI-JL.mjs";
|
|
2
1
|
import * as t from "@babel/types";
|
|
3
2
|
import { Expression, ObjectExpression } from "@babel/types";
|
|
3
|
+
import { t as AstEngineName } from "../types-urOiI-JL.mjs";
|
|
4
4
|
export interface JsxImportedComponent {
|
|
5
5
|
localName: string;
|
|
6
6
|
importSource: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import * as t from "@babel/types";
|
|
1
2
|
import { BABEL_TS_MODULE_PARSER_OPTIONS, parse, traverse } from "../babel.mjs";
|
|
2
3
|
import { getObjectPropertyByKey, resolveRenderableExpression } from "../babelNodes.mjs";
|
|
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
|
|
@@ -189,8 +189,7 @@ function resolveOxcComponentExpression(declaration, defineComponentDecls, define
|
|
|
189
189
|
if (normalized.type === "ObjectExpression") return normalized;
|
|
190
190
|
if (normalized.type === "Identifier") return defineComponentDecls.get(normalized.name) ?? null;
|
|
191
191
|
if (normalized.type === "CallExpression" && normalized.callee?.type === "Identifier" && defineComponentAliases.has(normalized.callee.name)) {
|
|
192
|
-
const
|
|
193
|
-
const unwrappedFirst = unwrapOxcExpression(first);
|
|
192
|
+
const unwrappedFirst = unwrapOxcExpression(normalized.arguments?.[0]);
|
|
194
193
|
if (unwrappedFirst?.type === "ObjectExpression") return unwrappedFirst;
|
|
195
194
|
if (unwrappedFirst?.type === "Identifier") return defineComponentDecls.get(unwrappedFirst.name) ?? null;
|
|
196
195
|
}
|
|
@@ -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-DNiSfKu0.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as AstParserLike, t as AstEngineName } from "../types-urOiI-JL.mjs";
|
|
2
1
|
import { Program } from "@oxc-project/types";
|
|
2
|
+
import { n as AstParserLike, t as AstEngineName } from "../types-urOiI-JL.mjs";
|
|
3
3
|
export declare const platformApiIdentifierList: readonly ["wx", "my", "tt", "swan", "jd", "xhs"];
|
|
4
4
|
export declare const platformApiIdentifiers: Set<"wx" | "my" | "tt" | "swan" | "jd" | "xhs">;
|
|
5
5
|
export declare function isPlatformApiIdentifier(name: string): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as parseJsLikeWithEngine } from "../engine-DNS4Kzzw.mjs";
|
|
2
|
-
import { a as loadNativeAstBindingSync, o as shouldUseNativeAst, r as analyzeScriptWithNative } from "../native-5s1fk2vp.mjs";
|
|
3
1
|
import { walk } from "oxc-walker";
|
|
2
|
+
import { t as parseJsLikeWithEngine } from "../engine-DNS4Kzzw.mjs";
|
|
3
|
+
import { a as loadNativeAstBindingSync, o as shouldUseNativeAst, r as analyzeScriptWithNative } from "../native-DjEAh5_8.mjs";
|
|
4
4
|
// src/operations/platformApi.ts
|
|
5
5
|
const platformApiIdentifierList = [
|
|
6
6
|
"wx",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as AstParserLike, t as AstEngineName } from "../types-urOiI-JL.mjs";
|
|
2
1
|
import { Program } from "@oxc-project/types";
|
|
2
|
+
import { n as AstParserLike, t as AstEngineName } from "../types-urOiI-JL.mjs";
|
|
3
3
|
export interface RequireToken {
|
|
4
4
|
start: number;
|
|
5
5
|
end: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as parseJsLikeWithEngine } from "../engine-DNS4Kzzw.mjs";
|
|
2
|
-
import { a as loadNativeAstBindingSync, o as shouldUseNativeAst, r as analyzeScriptWithNative } from "../native-5s1fk2vp.mjs";
|
|
3
1
|
import { walk } from "oxc-walker";
|
|
2
|
+
import { t as parseJsLikeWithEngine } from "../engine-DNS4Kzzw.mjs";
|
|
3
|
+
import { a as loadNativeAstBindingSync, o as shouldUseNativeAst, r as analyzeScriptWithNative } from "../native-DjEAh5_8.mjs";
|
|
4
4
|
// src/operations/require.ts
|
|
5
5
|
function mayContainRequireCallByText(code) {
|
|
6
6
|
return code.includes("require(") || code.includes("require (") || code.includes("require`");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BABEL_TS_MODULE_PARSER_OPTIONS, parse } from "../babel.mjs";
|
|
2
1
|
import { parseSync } from "oxc-parser";
|
|
2
|
+
import { BABEL_TS_MODULE_PARSER_OPTIONS, parse } from "../babel.mjs";
|
|
3
3
|
// src/operations/scriptSetupImports.ts
|
|
4
4
|
function mayContainRelevantScriptSetupImports(scriptSetup, templateComponentNames) {
|
|
5
5
|
if (templateComponentNames.size === 0) return false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { getMiniProgramDirectivePrefix, getSupportedMiniProgramPlatforms } from "@weapp-core/shared";
|
|
1
2
|
import { BABEL_TS_MODULE_PARSER_OPTIONS, parse, traverse } from "../babel.mjs";
|
|
2
3
|
import { t as parseJsLikeWithEngine } from "../engine-DNS4Kzzw.mjs";
|
|
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("|");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-vite/ast",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.13.0-dev.
|
|
4
|
+
"version": "7.13.0-dev.20261129.1",
|
|
5
5
|
"description": "weapp-vite 共享 AST 分析工具包,统一 Babel/Oxc 解析与常用分析操作",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"@babel/types": "^8.1.3",
|
|
118
118
|
"@oxc-project/types": "^0.160.0",
|
|
119
119
|
"@types/convert-source-map": "^2.0.3",
|
|
120
|
-
"@weapp-core/shared": "3.5.4-dev.
|
|
120
|
+
"@weapp-core/shared": "3.5.4-dev.20261129.1",
|
|
121
121
|
"oxc-parser": "^0.160.0",
|
|
122
122
|
"oxc-walker": "^1.1.1"
|
|
123
123
|
},
|
|
@@ -134,9 +134,9 @@
|
|
|
134
134
|
},
|
|
135
135
|
"repoctlSnapshot": {
|
|
136
136
|
"kind": "nightly",
|
|
137
|
-
"commit": "
|
|
138
|
-
"buildId": "
|
|
139
|
-
"identityKey": "
|
|
137
|
+
"commit": "8ee4e6b48b1533b065135f6732052a1ed44d420d",
|
|
138
|
+
"buildId": "46218456212-1",
|
|
139
|
+
"identityKey": "7b348394d2fa2249a07b7912914a0beae7dac4853984be3fae130a8ddd3bed7c",
|
|
140
140
|
"tag": "snapshot-nightly"
|
|
141
141
|
},
|
|
142
142
|
"scripts": {
|