@vtj/parser 0.11.16 → 0.12.0-alpha.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/index.cjs +6 -51
- package/dist/index.mjs +710 -31351
- package/package.json +9 -8
- package/types/index.d.ts +1 -0
- package/types/shared/utils.d.ts +7 -2
- package/types/version.d.ts +2 -2
- package/types/vue/index.d.ts +7 -0
- package/types/vue/scripts.d.ts +21 -0
- package/types/vue/style.d.ts +10 -0
- package/types/vue/template.d.ts +11 -0
- package/types/vue/utils.d.ts +16 -0
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vtj/parser",
|
3
3
|
"private": false,
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.12.0-alpha.1",
|
5
5
|
"type": "module",
|
6
6
|
"keywords": [
|
7
7
|
"低代码引擎",
|
@@ -21,17 +21,18 @@
|
|
21
21
|
"author": "chenhuachun",
|
22
22
|
"license": "MIT",
|
23
23
|
"dependencies": {
|
24
|
-
"@babel/generator": "~7.
|
25
|
-
"@babel/parser": "~7.
|
26
|
-
"@babel/traverse": "~7.
|
24
|
+
"@babel/generator": "~7.27.0",
|
25
|
+
"@babel/parser": "~7.27.0",
|
26
|
+
"@babel/traverse": "~7.27.0",
|
27
27
|
"@vue/compiler-dom": "~3.5.13",
|
28
28
|
"@vue/compiler-sfc": "~3.5.13",
|
29
|
-
"
|
30
|
-
"@vtj/
|
31
|
-
"@vtj/
|
29
|
+
"postcss": "~8.5.0",
|
30
|
+
"@vtj/base": "~0.12.0-alpha.1",
|
31
|
+
"@vtj/coder": "~0.12.0-alpha.1",
|
32
|
+
"@vtj/core": "~0.12.0-alpha.1"
|
32
33
|
},
|
33
34
|
"devDependencies": {
|
34
|
-
"@vtj/cli": "~0.
|
35
|
+
"@vtj/cli": "~0.12.0-alpha.1"
|
35
36
|
},
|
36
37
|
"exports": {
|
37
38
|
".": {
|
package/types/index.d.ts
CHANGED
package/types/shared/utils.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Node, File } from '@babel/types';
|
2
2
|
import { TraverseOptions } from '@babel/traverse';
|
3
|
+
import { JSExpression, JSFunction, NodeSchema } from '@vtj/core';
|
3
4
|
import { ParseResult } from '@babel/parser';
|
4
5
|
export declare function parseSFC(source: string): {
|
5
6
|
template: string;
|
@@ -7,5 +8,9 @@ export declare function parseSFC(source: string): {
|
|
7
8
|
styles: string[];
|
8
9
|
};
|
9
10
|
export declare function parseScript(script: string): ParseResult<File>;
|
10
|
-
export declare function traverseAST(ast: ReturnType<typeof parseScript>, options: TraverseOptions):
|
11
|
-
export declare function generateCode(node: Node):
|
11
|
+
export declare function traverseAST(ast: ReturnType<typeof parseScript>, options: TraverseOptions): any;
|
12
|
+
export declare function generateCode(node: Node): any;
|
13
|
+
export declare function isJSExpression(data: any): data is JSExpression;
|
14
|
+
export declare function isJSFunction(x: any): x is JSFunction;
|
15
|
+
export declare function isJSCode(data: unknown): data is JSExpression | JSFunction;
|
16
|
+
export declare function isNodeSchema(node: NodeSchema | JSExpression | string | null): node is NodeSchema;
|
package/types/version.d.ts
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* Copyright (c) 2025, VTJ.PRO All rights reserved.
|
3
3
|
* @name @vtj/parser
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
5
|
-
* @version 0.
|
5
|
+
* @version 0.12.0-alpha.0
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
7
7
|
*/
|
8
|
-
export declare const version = "0.
|
8
|
+
export declare const version = "0.12.0-alpha.0";
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { BlockSchema, ParseVueOptions, ProjectSchema } from '@vtj/core';
|
2
|
+
import { patchCode, replacer } from './utils';
|
3
|
+
export type IParseVueOptions = ParseVueOptions & {
|
4
|
+
project: ProjectSchema;
|
5
|
+
};
|
6
|
+
export { patchCode, replacer };
|
7
|
+
export declare function parseVue(options: IParseVueOptions): Promise<BlockSchema>;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { BlockState, JSFunction, BlockWatch, BlockProp, BlockEmit, BlockInject } from '@vtj/core';
|
2
|
+
export interface ImportStatement {
|
3
|
+
from: string;
|
4
|
+
imports: string[];
|
5
|
+
}
|
6
|
+
export interface ParseScriptsResult {
|
7
|
+
imports?: ImportStatement[];
|
8
|
+
name?: string;
|
9
|
+
state?: BlockState;
|
10
|
+
methods?: Record<string, JSFunction>;
|
11
|
+
computed?: Record<string, JSFunction>;
|
12
|
+
watchers?: Record<string, JSFunction>;
|
13
|
+
lifeCycles?: Record<string, JSFunction>;
|
14
|
+
watch?: BlockWatch[];
|
15
|
+
props?: Array<string | BlockProp>;
|
16
|
+
emits?: BlockEmit[];
|
17
|
+
inject?: BlockInject[];
|
18
|
+
handlers?: Record<string, JSFunction>;
|
19
|
+
errors: string[];
|
20
|
+
}
|
21
|
+
export declare function parseScripts(content: string): ParseScriptsResult;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { NodeSchema, BlockSlot, JSFunction } from '@vtj/core';
|
2
|
+
import { CSSRules } from './style';
|
3
|
+
export interface ParseTemplateOptions {
|
4
|
+
handlers?: Record<string, JSFunction>;
|
5
|
+
styles?: CSSRules;
|
6
|
+
}
|
7
|
+
export declare function parseTemplate(id: string, name: string, content?: string, options?: ParseTemplateOptions): {
|
8
|
+
nodes: NodeSchema[];
|
9
|
+
slots: BlockSlot[];
|
10
|
+
context: Record<string, Set<string>>;
|
11
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { JSExpression, JSFunction } from '@vtj/core';
|
2
|
+
export interface ExpressionOptions {
|
3
|
+
context: Record<string, Set<string>>;
|
4
|
+
computed: string[];
|
5
|
+
libs: Record<string, string>;
|
6
|
+
members: string[];
|
7
|
+
}
|
8
|
+
export declare function replacer(content: string, key: string, to: string): string;
|
9
|
+
export declare function patchCode(content: string, id: string, options: ExpressionOptions): string;
|
10
|
+
export declare function getJSExpression(content: string): JSExpression;
|
11
|
+
export declare function getJSFunction(content: string): JSFunction;
|
12
|
+
export declare const LIFE_CYCLES_LIST: string[];
|
13
|
+
export declare const HTML_TAGS: string[];
|
14
|
+
export declare const BUILD_IN_TAGS: string[];
|
15
|
+
export declare function formatTagName(tag: string): string;
|
16
|
+
export declare function isScss(source: string): boolean;
|