@weapp-vite/ast 7.12.2 → 7.13.0-dev.20261128.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 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.d.mts CHANGED
@@ -1,10 +1,10 @@
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 { parseJsLikeWithEngine } from "./engine.mjs";
4
+ import { A as NativeNpmLocalRootFact, C as NativeCompilerScriptInput, D as analyzeNpmChunksWithNative, E as analyzeCompilerScriptsWithNative, M as NativeNpmRequireFact, O as NativeNpmChunkAnalysis, S as NativeCompilerScriptImport, T as NativeOnPageScrollDiagnostic, _ as collectPageScrollInspectionWithOxc, a as getCallExpressionCalleeName, b as NativeCompilerRegisteredComponent, c as getOnPageScrollCallbackArgument, d as getOxcStaticPropertyName, f as isOnPageScrollCallee, g as collectOnPageScrollWarningsWithOxc, h as isStaticPropertyName, i as createWarningPrefix, j as NativeNpmPlatformApiFact, k as NativeNpmChunkAnalysisInput, 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, w as NativeCompilerScriptSpan, x as NativeCompilerScriptAnalysis, y as collectPageScrollInspection } from "./onPageScroll-h24XpECS.mjs";
4
5
  import { ComponentPropMap, collectComponentPropsFromCode, collectComponentPropsWithBabel, collectComponentPropsWithOxc, extractComponentProperties, extractPropertiesObject, getStaticPropertyName, mapConstructorName, mayContainComponentPropsShape, mergeComponentPropTypes, resolveOptionsObjectExpression, resolveOptionsObjectExpressionWithBabel, resolveTypeFromNode } from "./operations/componentProps.mjs";
5
6
  import { FeatureFlagOptions, collectFeatureFlagsFromCode, collectFeatureFlagsWithBabel, collectFeatureFlagsWithNative, collectFeatureFlagsWithNativeBatch, collectFeatureFlagsWithOxc, consumeNamedFeatureFlag, consumeNamespaceFeatureFlag, mayContainFeatureFlagHints, registerNamedFeatureFlagLocal, registerNamespaceFeatureFlagLocal } from "./operations/featureFlags.mjs";
6
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";
7
- 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";
8
8
  import { hasPlatformApiMemberExpression, isPlatformApiIdentifier, isPlatformApiMemberExpression, mayContainPlatformApiAccess, mayContainPlatformApiIdentifierByText, platformApiIdentifierList, platformApiIdentifiers } from "./operations/platformApi.mjs";
9
9
  import { DynamicImportToken, RequireCallbackToken, RequireToken, collectRequireTokens, getDynamicImportLiteralToken, getRequireAsyncLiteralToken, getRequireCallbackLiteralToken, getStaticRequireLiteralValue, hasStaticRequireCall, isStaticRequireCall, mayContainRequireCallByText, mayContainStaticRequireLiteral } from "./operations/require.mjs";
10
10
  import { n as AstParserLike, r as WeappAstConfig, t as AstEngineName } from "./types-urOiI-JL.mjs";
@@ -24,71 +24,6 @@ export declare const oxcAstEngine: {
24
24
  name: "oxc";
25
25
  parseJsLike(code: string, filename?: string): import("oxc-parser").Program;
26
26
  };
27
- interface NativeNpmChunkAnalysisInput {
28
- code: string;
29
- filename?: string;
30
- }
31
- interface NativeNpmRequireFact {
32
- start: number;
33
- end: number;
34
- importee: string;
35
- }
36
- interface NativeNpmPlatformApiFact {
37
- start: number;
38
- end: number;
39
- }
40
- interface NativeNpmLocalRootFact {
41
- kind: 'alias' | 'require' | 'interop';
42
- requireIndex?: number;
43
- bindingName?: string;
44
- referenceName?: string;
45
- importee?: string;
46
- secondArgumentStart?: number;
47
- secondArgumentEnd?: number;
48
- }
49
- interface NativeNpmChunkAnalysis {
50
- requires: NativeNpmRequireFact[];
51
- platformApiRanges: NativeNpmPlatformApiFact[];
52
- localRootFacts: NativeNpmLocalRootFact[];
53
- }
54
- interface NativeCompilerScriptInput {
55
- code: string;
56
- filename?: string;
57
- }
58
- interface NativeCompilerScriptImport {
59
- local: string;
60
- imported?: string;
61
- source: string;
62
- kind: 'default' | 'namespace' | 'named';
63
- typeOnly: boolean;
64
- }
65
- interface NativeCompilerRegisteredComponent {
66
- name: string;
67
- local: string;
68
- }
69
- interface NativeCompilerScriptSpan {
70
- start: number;
71
- end: number;
72
- }
73
- interface NativeCompilerScriptAnalysis {
74
- imports: NativeCompilerScriptImport[];
75
- /** 旧 binding 缺失该事实时,由编译阶段执行原有默认导出检查。 */
76
- hasDefaultExport?: boolean;
77
- defineOptionsStatements: NativeCompilerScriptSpan[];
78
- registeredComponents?: NativeCompilerRegisteredComponent[];
79
- /** 缺失表示旧 binding 或需由 Babel 完成诊断;空对象表示已确认无警告。 */
80
- reservedPropsDiagnostic?: {
81
- warningOffset?: number;
82
- };
83
- }
84
- /**
85
- * 编译器前端批量摘要的显式 native 快速路径;失败时由调用方继续使用 Babel/Oxc。
86
- */
87
- export declare function analyzeCompilerScriptsWithNative(inputs: NativeCompilerScriptInput[]): (NativeCompilerScriptAnalysis | null)[] | undefined;
88
- /**
89
- * 批量读取最终 chunk 的重写事实;默认关闭,任何批次或单项校验失败都交回 JS。
90
- */
91
- export declare function analyzeNpmChunksWithNative(inputs: NativeNpmChunkAnalysisInput[]): (NativeNpmChunkAnalysis | null)[] | undefined;
92
27
  interface ScriptAnalysisOptions<TFeature extends string = string> {
93
28
  engine?: AstEngineName;
94
29
  parserLike?: AstParserLike;
@@ -124,4 +59,4 @@ export declare function collectScriptCallStringLiterals(code: string): string[];
124
59
  * 快速判断脚本是否包含调用或模块语法,避免上层无条件扩大候选集。
125
60
  */
126
61
  export declare function mayContainScriptCallOrModuleSyntax(code: string): boolean;
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 ScriptSetupImportAnalysis, type WeappAstConfig, analyzeScriptSetupImportsFromCode, 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 };
62
+ 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 NativeOnPageScrollDiagnostic, type RequireCallbackToken, type RequireToken, type ScriptAnalysisBatchInput, type ScriptAnalysisOptions, type ScriptAnalysisResult, type ScriptSetupImport, type ScriptSetupImportAnalysis, type WeappAstConfig, analyzeCompilerScriptsWithNative, analyzeNpmChunksWithNative, analyzeScriptSetupImportsFromCode, 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,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-D8RHiEuF.mjs";
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-B0opLD0s.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-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";
@@ -46,6 +46,23 @@ function readComponent(value) {
46
46
  local
47
47
  } : void 0;
48
48
  }
49
+ function readPageScrollDiagnostic(value) {
50
+ if (!value || typeof value !== "object" || Array.isArray(value)) return;
51
+ const raw = value;
52
+ const kind = raw.kind;
53
+ const line = raw.line;
54
+ const column = raw.column;
55
+ const sourceLabel = raw.sourceLabel;
56
+ const syncApi = raw.syncApi;
57
+ if (kind !== "empty" && kind !== "setData" && kind !== "syncApi" || typeof line !== "number" || !Number.isSafeInteger(line) || line < 1 || typeof column !== "number" || !Number.isSafeInteger(column) || column < 1 || typeof sourceLabel !== "string" || syncApi !== void 0 && typeof syncApi !== "string" || kind === "syncApi" && typeof syncApi !== "string" || kind !== "syncApi" && syncApi !== void 0) return;
58
+ return {
59
+ kind,
60
+ line,
61
+ column,
62
+ sourceLabel,
63
+ ...syncApi === void 0 ? {} : { syncApi }
64
+ };
65
+ }
49
66
  /** 只保留校验后的自有摘要,不把可选 binding 的 getter 或可变容器传到编译阶段。 */
50
67
  function readNativeCompilerScriptAnalysis(value, code) {
51
68
  try {
@@ -68,7 +85,11 @@ function readNativeCompilerScriptAnalysis(value, code) {
68
85
  });
69
86
  const rawComponents = raw.registeredComponents;
70
87
  const registeredComponents = rawComponents === void 0 ? void 0 : readDenseArray$2(rawComponents, readComponent);
71
- if (imports === void 0 || defineOptionsStatements === void 0 || hasDefaultExport !== void 0 && typeof hasDefaultExport !== "boolean" || rawComponents !== void 0 && registeredComponents === void 0) return;
88
+ const rawPageFeatureFlags = raw.pageFeatureFlags;
89
+ const pageFeatureFlags = rawPageFeatureFlags === void 0 ? void 0 : readDenseArray$2(rawPageFeatureFlags, (value) => typeof value === "string" ? value : void 0);
90
+ const rawPageScrollDiagnostics = raw.onPageScrollDiagnostics;
91
+ const onPageScrollDiagnostics = rawPageScrollDiagnostics === void 0 ? void 0 : readDenseArray$2(rawPageScrollDiagnostics, readPageScrollDiagnostic);
92
+ if (imports === void 0 || defineOptionsStatements === void 0 || hasDefaultExport !== void 0 && typeof hasDefaultExport !== "boolean" || rawComponents !== void 0 && registeredComponents === void 0 || rawPageFeatureFlags !== void 0 && pageFeatureFlags === void 0 || rawPageScrollDiagnostics !== void 0 && onPageScrollDiagnostics === void 0) return;
72
93
  const rawDiagnostic = raw.reservedPropsDiagnostic;
73
94
  let reservedPropsDiagnostic;
74
95
  if (rawDiagnostic !== void 0) {
@@ -82,6 +103,8 @@ function readNativeCompilerScriptAnalysis(value, code) {
82
103
  ...hasDefaultExport === void 0 ? {} : { hasDefaultExport },
83
104
  defineOptionsStatements,
84
105
  ...registeredComponents === void 0 ? {} : { registeredComponents },
106
+ ...pageFeatureFlags === void 0 ? {} : { pageFeatureFlags },
107
+ ...onPageScrollDiagnostics === void 0 ? {} : { onPageScrollDiagnostics },
85
108
  ...reservedPropsDiagnostic === void 0 ? {} : { reservedPropsDiagnostic }
86
109
  };
87
110
  } catch {
@@ -317,17 +340,23 @@ function analyzeCompilerScriptsWithNative(inputs) {
317
340
  const fallback = () => null;
318
341
  const analyzeNative = loadNativeAstBindingSync()?.analyzeCompilerScriptsNative;
319
342
  if (!analyzeNative) return inputs.map(fallback);
343
+ const nativeInputs = inputs.map((input) => ({
344
+ code: input.code,
345
+ filename: input.filename ?? "inline.ts",
346
+ pageFeatureModules: input.pageFeatureModules,
347
+ pageFeatureHookToFeatureJson: input.pageFeatureHookToFeatureJson,
348
+ collectOnPageScrollDiagnostics: input.collectOnPageScrollDiagnostics
349
+ }));
320
350
  let results;
321
351
  try {
322
- results = analyzeNative(inputs);
352
+ results = analyzeNative(nativeInputs);
323
353
  } catch {
324
354
  return inputs.map(fallback);
325
355
  }
326
356
  if (!Array.isArray(results) || results.length !== inputs.length) return inputs.map(fallback);
327
357
  return inputs.map((input, index) => {
328
358
  try {
329
- const result = results[index];
330
- return readNativeCompilerScriptAnalysis(result, input.code) ?? fallback();
359
+ return readNativeCompilerScriptAnalysis(results[index], input.code) ?? fallback();
331
360
  } catch {
332
361
  return fallback();
333
362
  }
@@ -1,7 +1,7 @@
1
- import { a as loadNativeAstBindingSync, o as shouldUseNativeAst } from "./native-D8RHiEuF.mjs";
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 line = node.loc?.start.line;
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}),可能阻塞渲染线程。`);
@@ -246,12 +245,12 @@ function formatNativeOnPageScrollWarning(diagnostic, filename) {
246
245
  if (diagnostic.kind === "setData") return `${prefix} 检测到 ${diagnostic.sourceLabel} 内调用 setData,建议改用节流、IntersectionObserver 或合并更新。`;
247
246
  return `${prefix} 检测到 ${diagnostic.sourceLabel} 内调用同步 API(${diagnostic.syncApi ?? "wx.*Sync"}),可能阻塞渲染线程。`;
248
247
  }
249
- function collectOnPageScrollWarningsWithNative(code, filename) {
250
- const collectNative = loadNativeAstBindingSync()?.collectOnPageScrollDiagnosticsNative;
251
- if (!collectNative) return;
248
+ function collectOnPageScrollWarningsWithNative(code, filename, knownDiagnostics) {
249
+ const diagnostics = knownDiagnostics ?? loadNativeAstBindingSync()?.collectOnPageScrollDiagnosticsNative?.(code, filename);
250
+ if (!diagnostics) return;
252
251
  const warnings = [];
253
252
  const warningSet = /* @__PURE__ */ new Set();
254
- for (const diagnostic of collectNative(code, filename)) {
253
+ for (const diagnostic of diagnostics) {
255
254
  const warning = formatNativeOnPageScrollWarning(diagnostic, filename);
256
255
  if (warningSet.has(warning)) continue;
257
256
  warningSet.add(warning);
@@ -0,0 +1,117 @@
1
+ import { t as AstEngineName } from "./types-urOiI-JL.mjs";
2
+ import * as t from "@babel/types";
3
+ interface NativeNpmChunkAnalysisInput {
4
+ code: string;
5
+ filename?: string;
6
+ }
7
+ interface NativeNpmRequireFact {
8
+ start: number;
9
+ end: number;
10
+ importee: string;
11
+ }
12
+ interface NativeNpmPlatformApiFact {
13
+ start: number;
14
+ end: number;
15
+ }
16
+ interface NativeNpmLocalRootFact {
17
+ kind: 'alias' | 'require' | 'interop';
18
+ requireIndex?: number;
19
+ bindingName?: string;
20
+ referenceName?: string;
21
+ importee?: string;
22
+ secondArgumentStart?: number;
23
+ secondArgumentEnd?: number;
24
+ }
25
+ interface NativeNpmChunkAnalysis {
26
+ requires: NativeNpmRequireFact[];
27
+ platformApiRanges: NativeNpmPlatformApiFact[];
28
+ localRootFacts: NativeNpmLocalRootFact[];
29
+ }
30
+ interface NativeOnPageScrollDiagnostic {
31
+ kind: 'empty' | 'setData' | 'syncApi';
32
+ line: number;
33
+ column: number;
34
+ sourceLabel: string;
35
+ syncApi?: string;
36
+ }
37
+ interface NativeCompilerScriptInput {
38
+ code: string;
39
+ filename?: string;
40
+ pageFeatureModules?: string[];
41
+ pageFeatureHookToFeatureJson?: string;
42
+ collectOnPageScrollDiagnostics?: boolean;
43
+ }
44
+ interface NativeCompilerScriptImport {
45
+ local: string;
46
+ imported?: string;
47
+ source: string;
48
+ kind: 'default' | 'namespace' | 'named';
49
+ typeOnly: boolean;
50
+ }
51
+ interface NativeCompilerRegisteredComponent {
52
+ name: string;
53
+ local: string;
54
+ }
55
+ interface NativeCompilerScriptSpan {
56
+ start: number;
57
+ end: number;
58
+ }
59
+ interface NativeCompilerScriptAnalysis {
60
+ imports: NativeCompilerScriptImport[];
61
+ /** 旧 binding 缺失该事实时,由编译阶段执行原有默认导出检查。 */
62
+ hasDefaultExport?: boolean;
63
+ defineOptionsStatements: NativeCompilerScriptSpan[];
64
+ registeredComponents?: NativeCompilerRegisteredComponent[];
65
+ /** 旧 binding 缺失该事实时,由编译阶段执行原有页面特性收集。 */
66
+ pageFeatureFlags?: string[];
67
+ /** 缺失表示旧 binding 或需由 Babel 完成诊断;空对象表示已确认无警告。 */
68
+ reservedPropsDiagnostic?: {
69
+ warningOffset?: number;
70
+ };
71
+ /** 缺失表示旧 binding 未提供该诊断;空数组表示已确认没有滚动回调风险。 */
72
+ onPageScrollDiagnostics?: NativeOnPageScrollDiagnostic[];
73
+ }
74
+ /**
75
+ * 编译器前端批量摘要的显式 native 快速路径;失败时由调用方继续使用 Babel/Oxc。
76
+ */
77
+ declare function analyzeCompilerScriptsWithNative(inputs: NativeCompilerScriptInput[]): (NativeCompilerScriptAnalysis | null)[] | undefined;
78
+ /**
79
+ * 批量读取最终 chunk 的重写事实;默认关闭,任何批次或单项校验失败都交回 JS。
80
+ */
81
+ declare function analyzeNpmChunksWithNative(inputs: NativeNpmChunkAnalysisInput[]): (NativeNpmChunkAnalysis | null)[] | undefined;
82
+ interface PageScrollInspection {
83
+ empty: boolean;
84
+ hasSetDataCall: boolean;
85
+ syncApis: Set<string>;
86
+ }
87
+ interface OxcLoc {
88
+ line: number;
89
+ column: number;
90
+ }
91
+ declare function collectPageScrollInspection(functionPath: any, node: t.ArrowFunctionExpression | t.FunctionExpression | t.ObjectMethod): PageScrollInspection;
92
+ declare function collectOnPageScrollWarningsWithBabel(code: string, filename: string): string[];
93
+ declare function collectPageScrollInspectionWithOxc(node: any): PageScrollInspection;
94
+ declare function collectOnPageScrollWarningsWithOxc(code: string, filename: string): string[];
95
+ declare function isStaticPropertyName(key: t.Expression | t.Identifier | t.PrivateName): string | undefined;
96
+ declare function getMemberExpressionPropertyName(node: t.MemberExpression | t.OptionalMemberExpression): string | undefined;
97
+ declare function isOnPageScrollCallee(callee: t.Expression | t.V8IntrinsicIdentifier, hookNames: Set<string>, namespaceImports: Set<string>): boolean;
98
+ declare function getCallExpressionCalleeName(callee: t.Expression | t.V8IntrinsicIdentifier): string | undefined;
99
+ declare function getOnPageScrollCallbackArgument(node: {
100
+ arguments?: Array<t.Expression | t.SpreadElement | t.ArgumentPlaceholder | null>;
101
+ }): t.FunctionExpression | t.ArrowFunctionExpression | undefined;
102
+ declare function createWarningPrefix(filename: string, line?: number, column?: number): string;
103
+ declare function getOxcStaticPropertyName(node: any): string | undefined;
104
+ declare function getOxcMemberExpressionPropertyName(node: any): string | undefined;
105
+ declare function isOxcFunctionLike(node: any): boolean;
106
+ declare function isOxcOnPageScrollCallee(callee: any, hookNames: Set<string>, namespaceImports: Set<string>): boolean;
107
+ declare function getOxcCallExpressionCalleeName(callee: any): string | undefined;
108
+ declare function createLineStartOffsets(code: string): number[];
109
+ declare function getLocationFromOffset(offset: number | undefined, lineStarts: number[]): OxcLoc | undefined;
110
+ declare function collectOnPageScrollWarningsWithNative(code: string, filename: string, knownDiagnostics?: readonly NativeOnPageScrollDiagnostic[]): string[] | undefined;
111
+ /**
112
+ * 静态检测 onPageScroll 中的常见性能风险并返回告警文案。
113
+ */
114
+ declare function collectOnPageScrollPerformanceWarnings(code: string, filename: string, options?: {
115
+ engine?: AstEngineName;
116
+ }): string[];
117
+ export { NativeNpmLocalRootFact as A, NativeCompilerScriptInput as C, analyzeNpmChunksWithNative as D, analyzeCompilerScriptsWithNative as E, NativeNpmRequireFact as M, NativeNpmChunkAnalysis as O, NativeCompilerScriptImport as S, NativeOnPageScrollDiagnostic as T, collectPageScrollInspectionWithOxc as _, getCallExpressionCalleeName as a, NativeCompilerRegisteredComponent as b, getOnPageScrollCallbackArgument as c, getOxcStaticPropertyName as d, isOnPageScrollCallee as f, collectOnPageScrollWarningsWithOxc as g, isStaticPropertyName as h, createWarningPrefix as i, NativeNpmPlatformApiFact as j, NativeNpmChunkAnalysisInput as k, 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, NativeCompilerScriptSpan as w, NativeCompilerScriptAnalysis as x, collectPageScrollInspection as y };
@@ -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-D8RHiEuF.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 first = normalized.arguments?.[0];
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,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-9kwtAWzG.mjs";
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-h24XpECS.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-B0opLD0s.mjs";
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-D8RHiEuF.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-D8RHiEuF.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.12.2",
4
+ "version": "7.13.0-dev.20261128.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.3",
120
+ "@weapp-core/shared": "3.5.4-dev.20261128.1",
121
121
  "oxc-parser": "^0.160.0",
122
122
  "oxc-walker": "^1.1.1"
123
123
  },
@@ -129,7 +129,15 @@
129
129
  },
130
130
  "publishConfig": {
131
131
  "access": "public",
132
- "registry": "https://registry.npmjs.org"
132
+ "registry": "https://registry.npmjs.org/",
133
+ "tag": "snapshot-nightly"
134
+ },
135
+ "repoctlSnapshot": {
136
+ "kind": "nightly",
137
+ "commit": "ec17eeb0c156fc6691bcbaf95e8686ac419a6e94",
138
+ "buildId": "46104956345-1",
139
+ "identityKey": "f53748ff8746c04dadf1ec0a2e5eb10f2a35ae28f655c747062d631b66171144",
140
+ "tag": "snapshot-nightly"
133
141
  },
134
142
  "scripts": {
135
143
  "dev": "tsdown -w",
@@ -144,4 +152,4 @@
144
152
  "lint": "eslint .",
145
153
  "lint:fix": "eslint . --fix"
146
154
  }
147
- }
155
+ }
@@ -1,38 +0,0 @@
1
- import { t as AstEngineName } from "./types-urOiI-JL.mjs";
2
- import * as t from "@babel/types";
3
- interface PageScrollInspection {
4
- empty: boolean;
5
- hasSetDataCall: boolean;
6
- syncApis: Set<string>;
7
- }
8
- interface OxcLoc {
9
- line: number;
10
- column: number;
11
- }
12
- declare function collectPageScrollInspection(functionPath: any, node: t.ArrowFunctionExpression | t.FunctionExpression | t.ObjectMethod): PageScrollInspection;
13
- declare function collectOnPageScrollWarningsWithBabel(code: string, filename: string): string[];
14
- declare function collectPageScrollInspectionWithOxc(node: any): PageScrollInspection;
15
- declare function collectOnPageScrollWarningsWithOxc(code: string, filename: string): string[];
16
- declare function isStaticPropertyName(key: t.Expression | t.Identifier | t.PrivateName): string | undefined;
17
- declare function getMemberExpressionPropertyName(node: t.MemberExpression | t.OptionalMemberExpression): string | undefined;
18
- declare function isOnPageScrollCallee(callee: t.Expression | t.V8IntrinsicIdentifier, hookNames: Set<string>, namespaceImports: Set<string>): boolean;
19
- declare function getCallExpressionCalleeName(callee: t.Expression | t.V8IntrinsicIdentifier): string | undefined;
20
- declare function getOnPageScrollCallbackArgument(node: {
21
- arguments?: Array<t.Expression | t.SpreadElement | t.ArgumentPlaceholder | null>;
22
- }): t.FunctionExpression | t.ArrowFunctionExpression | undefined;
23
- declare function createWarningPrefix(filename: string, line?: number, column?: number): string;
24
- declare function getOxcStaticPropertyName(node: any): string | undefined;
25
- declare function getOxcMemberExpressionPropertyName(node: any): string | undefined;
26
- declare function isOxcFunctionLike(node: any): boolean;
27
- declare function isOxcOnPageScrollCallee(callee: any, hookNames: Set<string>, namespaceImports: Set<string>): boolean;
28
- declare function getOxcCallExpressionCalleeName(callee: any): string | undefined;
29
- declare function createLineStartOffsets(code: string): number[];
30
- declare function getLocationFromOffset(offset: number | undefined, lineStarts: number[]): OxcLoc | undefined;
31
- declare function collectOnPageScrollWarningsWithNative(code: string, filename: string): string[] | undefined;
32
- /**
33
- * 静态检测 onPageScroll 中的常见性能风险并返回告警文案。
34
- */
35
- declare function collectOnPageScrollPerformanceWarnings(code: string, filename: string, options?: {
36
- engine?: AstEngineName;
37
- }): string[];
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 };