@vtj/parser 0.12.55 → 0.12.56

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vtj/parser",
3
3
  "private": false,
4
- "version": "0.12.55",
4
+ "version": "0.12.56",
5
5
  "type": "module",
6
6
  "keywords": [
7
7
  "低代码引擎",
@@ -21,17 +21,19 @@
21
21
  "author": "chenhuachun",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
+ "@babel/core": "~7.28.0",
24
25
  "@babel/generator": "~7.28.0",
25
26
  "@babel/parser": "~7.28.0",
26
27
  "@babel/traverse": "~7.28.0",
28
+ "@babel/types": "~7.28.0",
27
29
  "@vue/compiler-dom": "~3.5.13",
28
30
  "@vue/compiler-sfc": "~3.5.13",
29
31
  "htmlparser2": "~10.0.0",
30
32
  "postcss": "~8.5.0",
31
33
  "sass": "~1.89.0",
34
+ "@vtj/coder": "~0.12.56",
32
35
  "@vtj/base": "~0.12.2",
33
- "@vtj/coder": "~0.12.55",
34
- "@vtj/core": "~0.12.55"
36
+ "@vtj/core": "~0.12.56"
35
37
  },
36
38
  "devDependencies": {
37
39
  "@vtj/cli": "~0.12.8"
package/types/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { version as VTJ_PARSER_VERSION } from './version';
2
2
  export * from './uni';
3
3
  export * from './vue';
4
+ export * from './tools';
@@ -1,3 +1,4 @@
1
+ import { Visitor } from '@babel/core';
1
2
  import { Node, File } from '@babel/types';
2
3
  import { TraverseOptions } from '@babel/traverse';
3
4
  import { JSExpression, JSFunction, NodeSchema } from '@vtj/core';
@@ -14,3 +15,4 @@ export declare function isJSExpression(data: any): data is JSExpression;
14
15
  export declare function isJSFunction(x: any): x is JSFunction;
15
16
  export declare function isJSCode(data: unknown): data is JSExpression | JSFunction;
16
17
  export declare function isNodeSchema(node: NodeSchema | JSExpression | string | null): node is NodeSchema;
18
+ export declare function transformScript(script: string, visitor: Visitor): string;
@@ -0,0 +1,7 @@
1
+ import { ValidationResult } from './validator';
2
+ export declare class AutoFixer {
3
+ fixBasedOnValidation(code: string, validation: ValidationResult): string;
4
+ private fixVantIcons;
5
+ private fixVtjIcons;
6
+ private reconstructSFC;
7
+ }
@@ -0,0 +1,4 @@
1
+ export declare const VantIcons: string[];
2
+ export declare const VtjIcons: string[];
3
+ export declare const defaultVantIcon = "user";
4
+ export declare const defaultVtjIcon = "User";
@@ -0,0 +1,2 @@
1
+ export * from './validator';
2
+ export * from './fixer';
@@ -0,0 +1,14 @@
1
+ interface FixResult {
2
+ fixed: boolean;
3
+ originalCode: string;
4
+ fixedCode: string;
5
+ changes: Array<{
6
+ line: number;
7
+ column: number;
8
+ original: string;
9
+ fixed: string;
10
+ message: string;
11
+ }>;
12
+ }
13
+ export declare function checkAndFixStatePrefix(vueCode: string): FixResult;
14
+ export {};
@@ -0,0 +1,16 @@
1
+ export type ValidationResult = {
2
+ valid: boolean;
3
+ errors: string[];
4
+ illegalVantIcons: string[];
5
+ illegalVtjIcons: string[];
6
+ };
7
+ export declare class ComponentValidator {
8
+ validate(code: string): ValidationResult;
9
+ private isCompleteSFC;
10
+ private checkSetup;
11
+ private findVantIcons;
12
+ private checkVantIcons;
13
+ private findVtjIcons;
14
+ private checkVtjIcons;
15
+ private hasUnchangedComment;
16
+ }
@@ -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.12.54
5
+ * @version 0.12.55
6
6
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
7
7
  */
8
- export declare const version = "0.12.54";
8
+ export declare const version = "0.12.55";
@@ -1,4 +1,4 @@
1
- import { JSExpression, JSFunction, PlatformType } from '@vtj/core';
1
+ import { JSExpression, JSFunction, PlatformType, DataSourceSchema } from '@vtj/core';
2
2
  export interface ExpressionOptions {
3
3
  platform: PlatformType;
4
4
  context: Record<string, Set<string>>;
@@ -18,5 +18,5 @@ export declare function isUniTags(tag: string, platform?: PlatformType): boolean
18
18
  export declare function formatTagName(tag: string, platform?: PlatformType): string;
19
19
  export declare function isScss(source: string): boolean;
20
20
  export declare function styleToJson(style: string): Record<string, string>;
21
- export declare function validate(content: string): string[];
22
21
  export declare function mergeClass(staticClass: string, expSource: string, type: 'ObjectExpression' | 'ArrayExpression'): string | undefined;
22
+ export declare function extractDataSource(comment?: string): DataSourceSchema | null;