@weapp-vite/volar 2.1.6 → 2.1.8
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 +10 -4
- package/dist/index.mjs +10 -4
- package/dist/jsonBlock.test.d.ts +1 -0
- package/package.json +14 -6
package/dist/index.cjs
CHANGED
|
@@ -118,16 +118,22 @@ function getEmbeddedCodesFromCustomBlocks(sfc) {
|
|
|
118
118
|
function findExportDefaultExpression(code, tsModule, lang) {
|
|
119
119
|
const scriptKind = lang === "ts" ? 3 : 1;
|
|
120
120
|
const sourceFile = tsModule.createSourceFile(`config.${lang}`, code, 99, true, scriptKind);
|
|
121
|
+
const scanner = tsModule.createScanner(99, true, void 0, code);
|
|
122
|
+
const tokenStart = (position) => {
|
|
123
|
+
scanner.setTextPos(position);
|
|
124
|
+
scanner.scan();
|
|
125
|
+
return scanner.getTokenPos();
|
|
126
|
+
};
|
|
121
127
|
for (const statement of sourceFile.statements) if (tsModule.isExportAssignment(statement)) {
|
|
122
|
-
const expressionStart = statement.expression.
|
|
123
|
-
const expressionEnd = statement.expression.
|
|
124
|
-
const leading = code.slice(0, statement.
|
|
128
|
+
const expressionStart = tokenStart(statement.expression.pos);
|
|
129
|
+
const expressionEnd = statement.expression.end;
|
|
130
|
+
const leading = code.slice(0, tokenStart(statement.pos));
|
|
125
131
|
return {
|
|
126
132
|
expression: code.slice(expressionStart, expressionEnd),
|
|
127
133
|
expressionStart,
|
|
128
134
|
expressionEnd,
|
|
129
135
|
leading,
|
|
130
|
-
trailing: code.slice(statement.
|
|
136
|
+
trailing: code.slice(statement.end)
|
|
131
137
|
};
|
|
132
138
|
}
|
|
133
139
|
return null;
|
package/dist/index.mjs
CHANGED
|
@@ -94,16 +94,22 @@ function getEmbeddedCodesFromCustomBlocks(sfc) {
|
|
|
94
94
|
function findExportDefaultExpression(code, tsModule, lang) {
|
|
95
95
|
const scriptKind = lang === "ts" ? 3 : 1;
|
|
96
96
|
const sourceFile = tsModule.createSourceFile(`config.${lang}`, code, 99, true, scriptKind);
|
|
97
|
+
const scanner = tsModule.createScanner(99, true, void 0, code);
|
|
98
|
+
const tokenStart = (position) => {
|
|
99
|
+
scanner.setTextPos(position);
|
|
100
|
+
scanner.scan();
|
|
101
|
+
return scanner.getTokenPos();
|
|
102
|
+
};
|
|
97
103
|
for (const statement of sourceFile.statements) if (tsModule.isExportAssignment(statement)) {
|
|
98
|
-
const expressionStart = statement.expression.
|
|
99
|
-
const expressionEnd = statement.expression.
|
|
100
|
-
const leading = code.slice(0, statement.
|
|
104
|
+
const expressionStart = tokenStart(statement.expression.pos);
|
|
105
|
+
const expressionEnd = statement.expression.end;
|
|
106
|
+
const leading = code.slice(0, tokenStart(statement.pos));
|
|
101
107
|
return {
|
|
102
108
|
expression: code.slice(expressionStart, expressionEnd),
|
|
103
109
|
expressionStart,
|
|
104
110
|
expressionEnd,
|
|
105
111
|
leading,
|
|
106
|
-
trailing: code.slice(statement.
|
|
112
|
+
trailing: code.slice(statement.end)
|
|
107
113
|
};
|
|
108
114
|
}
|
|
109
115
|
return null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-vite/volar",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.8",
|
|
4
4
|
"description": "Volar plugin for weapp-vite - Provides IntelliSense and type checking for WeChat mini-program config blocks",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/weapp-vite/weapp-vite#readme",
|
|
7
8
|
"repository": {
|
|
8
9
|
"type": "git",
|
|
9
10
|
"url": "git+https://github.com/weapp-vite/weapp-vite.git",
|
|
@@ -13,14 +14,17 @@
|
|
|
13
14
|
"url": "https://github.com/weapp-vite/weapp-vite/issues"
|
|
14
15
|
},
|
|
15
16
|
"keywords": [
|
|
16
|
-
"
|
|
17
|
-
"
|
|
17
|
+
"weapp-vite",
|
|
18
|
+
"weapp",
|
|
18
19
|
"wechat",
|
|
20
|
+
"mini-program",
|
|
19
21
|
"miniprogram",
|
|
20
|
-
"
|
|
22
|
+
"volar",
|
|
23
|
+
"vue",
|
|
21
24
|
"intellisense",
|
|
22
25
|
"typescript",
|
|
23
|
-
"json-schema"
|
|
26
|
+
"json-schema",
|
|
27
|
+
"vite"
|
|
24
28
|
],
|
|
25
29
|
"sideEffects": false,
|
|
26
30
|
"exports": {
|
|
@@ -39,8 +43,12 @@
|
|
|
39
43
|
"engines": {
|
|
40
44
|
"node": "^20.19.0 || >=22.12.0"
|
|
41
45
|
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public",
|
|
48
|
+
"registry": "https://registry.npmjs.org"
|
|
49
|
+
},
|
|
42
50
|
"dependencies": {
|
|
43
|
-
"@weapp-core/schematics": "6.2.
|
|
51
|
+
"@weapp-core/schematics": "6.2.4"
|
|
44
52
|
},
|
|
45
53
|
"scripts": {
|
|
46
54
|
"benchmark": "node --import tsx benchmark/sfc.ts",
|