@weapp-vite/ast-native 0.1.9 → 0.2.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.
Files changed (3) hide show
  1. package/index.d.ts +71 -0
  2. package/index.js +4 -0
  3. package/package.json +6 -6
package/index.d.ts CHANGED
@@ -19,6 +19,77 @@ export interface NativeScriptAnalysisInput {
19
19
  filename?: string
20
20
  }
21
21
 
22
+ export interface NativeCompilerScriptInput {
23
+ code: string
24
+ filename?: string
25
+ }
26
+
27
+ export interface NativeCompilerScriptImport {
28
+ local: string
29
+ imported?: string
30
+ source: string
31
+ kind: 'default' | 'namespace' | 'named'
32
+ typeOnly: boolean
33
+ }
34
+
35
+ export interface NativeCompilerRegisteredComponent {
36
+ name: string
37
+ local: string
38
+ }
39
+
40
+ export interface NativeCompilerScriptSpan {
41
+ start: number
42
+ end: number
43
+ }
44
+
45
+ export interface NativeCompilerScriptAnalysis {
46
+ imports: NativeCompilerScriptImport[]
47
+ hasDefaultExport: boolean
48
+ defineOptionsStatements: NativeCompilerScriptSpan[]
49
+ registeredComponents?: NativeCompilerRegisteredComponent[]
50
+ reservedPropsDiagnostic?: { warningOffset?: number }
51
+ }
52
+
53
+ export interface NativeNpmChunkAnalysisInput {
54
+ code: string
55
+ filename?: string
56
+ }
57
+
58
+ export interface NativeNpmRequireFact {
59
+ start: number
60
+ end: number
61
+ importee: string
62
+ }
63
+
64
+ export interface NativeNpmPlatformApiFact {
65
+ start: number
66
+ end: number
67
+ }
68
+
69
+ export interface NativeNpmLocalRootFact {
70
+ kind: 'alias' | 'require' | 'interop'
71
+ requireIndex?: number
72
+ bindingName?: string
73
+ referenceName?: string
74
+ importee?: string
75
+ secondArgumentStart?: number
76
+ secondArgumentEnd?: number
77
+ }
78
+
79
+ export interface NativeNpmChunkAnalysis {
80
+ requires: NativeNpmRequireFact[]
81
+ platformApiRanges: NativeNpmPlatformApiFact[]
82
+ localRootFacts: NativeNpmLocalRootFact[]
83
+ }
84
+
85
+ export function analyzeNpmChunksNative(
86
+ inputs: NativeNpmChunkAnalysisInput[],
87
+ ): Array<NativeNpmChunkAnalysis | null>
88
+
89
+ export function analyzeCompilerScriptsNative(
90
+ inputs: NativeCompilerScriptInput[],
91
+ ): Array<NativeCompilerScriptAnalysis | null>
92
+
22
93
  export function analyzeScriptNative(
23
94
  code: string,
24
95
  moduleId?: string,
package/index.js CHANGED
@@ -19,6 +19,8 @@ if (!bindingPath) {
19
19
  }
20
20
 
21
21
  const {
22
+ analyzeCompilerScriptsNative,
23
+ analyzeNpmChunksNative,
22
24
  analyzeScriptNative,
23
25
  analyzeScriptsNative,
24
26
  collectFeatureFlagsNative,
@@ -33,6 +35,8 @@ function getVueSfcSignaturePayloadNative(source) {
33
35
  }
34
36
 
35
37
  export {
38
+ analyzeCompilerScriptsNative,
39
+ analyzeNpmChunksNative,
36
40
  analyzeScriptNative,
37
41
  analyzeScriptsNative,
38
42
  collectFeatureFlagsNative,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@weapp-vite/ast-native",
3
3
  "type": "module",
4
- "version": "0.1.9",
4
+ "version": "0.2.0",
5
5
  "description": "weapp-vite Rust/Oxc native AST analysis prototype",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -43,13 +43,13 @@
43
43
  "index.js"
44
44
  ],
45
45
  "engines": {
46
- "node": ">=22.13.0"
46
+ "node": "^22.23.4 || ^24.22.1 || >=26.12.1"
47
47
  },
48
48
  "devDependencies": {
49
- "@napi-rs/cli": "^3.10.8",
50
- "@types/node": "^26.6.4",
51
- "eslint": "^10.12.0",
52
- "vitest": "5.0.3"
49
+ "@napi-rs/cli": "^3.10.9",
50
+ "@types/node": "^26.6.5",
51
+ "eslint": "^10.13.0",
52
+ "vitest": "5.0.5"
53
53
  },
54
54
  "napi": {
55
55
  "binaryName": "weapp_vite_ast_native",