@golar/vue 0.0.14 → 0.0.16
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/language-plugin.js
CHANGED
|
@@ -9,6 +9,31 @@ import PluginVueTemplateHtml from "@vue/language-core/lib/plugins/vue-template-h
|
|
|
9
9
|
import PluginVueStyleCSS from "@vue/language-core/lib/plugins/vue-style-css.js";
|
|
10
10
|
|
|
11
11
|
//#region src/language-plugin.ts
|
|
12
|
+
const SUPPRESSED_DIAGNOSTIC_CODES = [
|
|
13
|
+
2339,
|
|
14
|
+
2551,
|
|
15
|
+
2353,
|
|
16
|
+
2561,
|
|
17
|
+
6133
|
|
18
|
+
];
|
|
19
|
+
var GolarVueVirtualCode = class extends VueVirtualCode {
|
|
20
|
+
get embeddedCodes() {
|
|
21
|
+
const embeddedCodes = super.embeddedCodes;
|
|
22
|
+
const walk = (code) => {
|
|
23
|
+
for (const m of code.mappings) {
|
|
24
|
+
const data = m.data;
|
|
25
|
+
if (data.__suppressedDiagnostics != null) continue;
|
|
26
|
+
if (data.verification == null || typeof data.verification !== "object" || !("shouldReport" in data.verification) || typeof data.verification.shouldReport !== "function") continue;
|
|
27
|
+
const shouldReport = data.verification.shouldReport;
|
|
28
|
+
const suppressed = SUPPRESSED_DIAGNOSTIC_CODES.filter((code) => !shouldReport(void 0, code));
|
|
29
|
+
if (suppressed.length) data.__suppressedDiagnostics = [...suppressed];
|
|
30
|
+
}
|
|
31
|
+
for (const child of code.embeddedCodes ?? []) walk(child);
|
|
32
|
+
};
|
|
33
|
+
for (const code of embeddedCodes) walk(code);
|
|
34
|
+
return embeddedCodes;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
12
37
|
function vueLanguagePlugin(cwd, configFileName) {
|
|
13
38
|
const { options: compilerOptions, vueOptions: vueCompilerOptions } = configFileName == null ? createParsedCommandLineByJson(typescript_lite_exports, sys, cwd, {}) : createParsedCommandLine(typescript_lite_exports, sys, configFileName);
|
|
14
39
|
const plugins = [
|
|
@@ -30,7 +55,7 @@ function vueLanguagePlugin(cwd, configFileName) {
|
|
|
30
55
|
return scriptId.endsWith(".vue") ? "vue" : void 0;
|
|
31
56
|
},
|
|
32
57
|
createVirtualCode(scriptId, languageId, snapshot) {
|
|
33
|
-
return new
|
|
58
|
+
return new GolarVueVirtualCode(scriptId, languageId, snapshot, vueCompilerOptions, plugins, typescript_lite_exports);
|
|
34
59
|
},
|
|
35
60
|
getVirtualCodeErrors(root) {
|
|
36
61
|
return root.vueSfc.errors.filter((e) => "code" in e).map((e) => ({
|
|
@@ -20,13 +20,16 @@ function patchFile(filePath, patch) {
|
|
|
20
20
|
patchFile("@vue/language-core/lib/codegen/template/context.js", (src) => {
|
|
21
21
|
src = replaceOrThrow(src, "function createTemplateCodegenContext()", () => `function createTemplateCodegenContext(options)`);
|
|
22
22
|
src = replaceOrThrow(src, "function resolveCodeFeatures", (s) => `${s}(...args) {
|
|
23
|
-
|
|
23
|
+
let features = _resolveCodeFeatures(...args)
|
|
24
24
|
const data = stack.at(-1)
|
|
25
25
|
if (data?.expectError != null) {
|
|
26
|
-
features
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
features = {
|
|
27
|
+
...features,
|
|
28
|
+
__expectErrorCommentLoc: [
|
|
29
|
+
(options?.template?.startTagEnd ?? 0) + data.expectError.node.loc.start.offset,
|
|
30
|
+
(options?.template?.startTagEnd ?? 0) + data.expectError.node.loc.end.offset,
|
|
31
|
+
],
|
|
32
|
+
}
|
|
30
33
|
}
|
|
31
34
|
return features
|
|
32
35
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golar/vue",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./golar-entry": "./dist/golar-entry.js"
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@vue/compiler-dom": "^3.5.0",
|
|
25
|
-
"@vue/language-core": "3.2.
|
|
26
|
-
"@golar/
|
|
27
|
-
"@golar/
|
|
25
|
+
"@vue/language-core": "3.2.5",
|
|
26
|
+
"@golar/util": "0.0.16",
|
|
27
|
+
"@golar/volar": "0.0.16"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@vue/compiler-sfc": "^3.5.27",
|
|
@@ -32,6 +32,6 @@
|
|
|
32
32
|
"typescript": "^5.9.3"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
|
-
"build-typescript-lite": "cd ../../thirdparty/typescript && npm install && npx hereby generate-diagnostics && cd
|
|
35
|
+
"build-typescript-lite": "cd ../../thirdparty/typescript && npm install && npx hereby generate-diagnostics && cd ../../packages/vue && node ./scripts/build-typescript-lite.ts"
|
|
36
36
|
}
|
|
37
37
|
}
|