@weapp-vite/volar 2.1.14 → 2.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.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- //#region \0rolldown/runtime.js
1
+ // \0rolldown/runtime.js
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -19,17 +19,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
19
19
  value: mod,
20
20
  enumerable: true
21
21
  }) : target, mod));
22
- //#endregion
23
22
  let node_module = require("node:module");
24
23
  let node_path = require("node:path");
25
24
  node_path = __toESM(node_path);
26
25
  let node_process = require("node:process");
27
26
  node_process = __toESM(node_process);
28
27
  let _weapp_core_schematics = require("@weapp-core/schematics");
29
- //#region package.json
28
+ // package.json
30
29
  var name = "@weapp-vite/volar";
31
- //#endregion
32
- //#region src/constants.ts
30
+ // src/constants.ts
33
31
  const BLOCK_TYPE = "json";
34
32
  const JSONC_LANG = "jsonc";
35
33
  const JSON_LANG = "json";
@@ -54,8 +52,7 @@ const VOID_CAPABILITIES = {
54
52
  structure: false,
55
53
  format: false
56
54
  };
57
- //#endregion
58
- //#region src/schema.ts
55
+ // src/schema.ts
59
56
  /**
60
57
  * 为小程序配置生成 JSON Schema
61
58
  * 为支持 JSON Schema 的编辑器提供验证和自动补全
@@ -72,8 +69,7 @@ function getSchemaForType(type) {
72
69
  if (!definition) return null;
73
70
  return definition.schema;
74
71
  }
75
- //#endregion
76
- //#region src/jsonBlock.ts
72
+ // src/jsonBlock.ts
77
73
  function normalizeFilename(filename) {
78
74
  if (!filename) return "";
79
75
  return filename.replace(BACKSLASH_RE, "/");
@@ -237,8 +233,7 @@ function resolveEmbeddedJsonBlock(fileName, sfc, embeddedCode, tsModule, hasSche
237
233
  FULL_CAPABILITIES
238
234
  ]);
239
235
  }
240
- //#endregion
241
- //#region src/parseSfc.ts
236
+ // src/parseSfc.ts
242
237
  function advancePosition(position, source, start = 0, end = source.length) {
243
238
  let lines = 0;
244
239
  let lastNewline = -1;
@@ -407,8 +402,7 @@ function updateSfc(sfc, change) {
407
402
  sfc.descriptor.source = source.slice(0, change.start) + change.newText + source.slice(change.end);
408
403
  return sfc;
409
404
  }
410
- //#endregion
411
- //#region src/scriptSetup.ts
405
+ // src/scriptSetup.ts
412
406
  function collectWxsModuleNames(templateContent) {
413
407
  if (!templateContent) return [];
414
408
  const names = /* @__PURE__ */ new Set();
@@ -687,8 +681,7 @@ function createDefineOptionsTemplateDeclarations(code, tsModule, lang) {
687
681
  function resolveScriptSetupLang(lang) {
688
682
  return lang === "js" ? "js" : "ts";
689
683
  }
690
- //#endregion
691
- //#region src/templateRef.ts
684
+ // src/templateRef.ts
692
685
  const SERVICE_SCRIPT_RE = /^script_([jt]sx?)$/;
693
686
  const WHITESPACE_RE = /\s/;
694
687
  const LINE_TERMINATOR_RE = /[\n\r\u2028\u2029]/;
@@ -759,8 +752,7 @@ function createTemplateRefPlugin(baseLib) {
759
752
  }
760
753
  };
761
754
  }
762
- //#endregion
763
- //#region src/index.ts
755
+ // src/index.ts
764
756
  const require$1 = (0, node_module.createRequire)(typeof module !== "undefined" && module.filename ? module.filename : node_path.default.join(node_process.default.cwd(), "weapp-vite-volar.cjs"));
765
757
  let hasSchematicsTypes = false;
766
758
  try {
@@ -846,5 +838,4 @@ const plugin = (ctx) => {
846
838
  };
847
839
  return ctx?.vueCompilerOptions ? [parserPlugin, createTemplateRefPlugin(ctx.vueCompilerOptions.lib)] : parserPlugin;
848
840
  };
849
- //#endregion
850
841
  module.exports = plugin;
package/dist/index.mjs CHANGED
@@ -2,10 +2,9 @@ import { createRequire } from "node:module";
2
2
  import path from "node:path";
3
3
  import process from "node:process";
4
4
  import { JSON_SCHEMA_DEFINITIONS } from "@weapp-core/schematics";
5
- //#region package.json
5
+ // package.json
6
6
  var name = "@weapp-vite/volar";
7
- //#endregion
8
- //#region src/constants.ts
7
+ // src/constants.ts
9
8
  const BLOCK_TYPE = "json";
10
9
  const JSONC_LANG = "jsonc";
11
10
  const JSON_LANG = "json";
@@ -30,8 +29,7 @@ const VOID_CAPABILITIES = {
30
29
  structure: false,
31
30
  format: false
32
31
  };
33
- //#endregion
34
- //#region src/schema.ts
32
+ // src/schema.ts
35
33
  /**
36
34
  * 为小程序配置生成 JSON Schema
37
35
  * 为支持 JSON Schema 的编辑器提供验证和自动补全
@@ -48,8 +46,7 @@ function getSchemaForType(type) {
48
46
  if (!definition) return null;
49
47
  return definition.schema;
50
48
  }
51
- //#endregion
52
- //#region src/jsonBlock.ts
49
+ // src/jsonBlock.ts
53
50
  function normalizeFilename(filename) {
54
51
  if (!filename) return "";
55
52
  return filename.replace(BACKSLASH_RE, "/");
@@ -213,8 +210,7 @@ function resolveEmbeddedJsonBlock(fileName, sfc, embeddedCode, tsModule, hasSche
213
210
  FULL_CAPABILITIES
214
211
  ]);
215
212
  }
216
- //#endregion
217
- //#region src/parseSfc.ts
213
+ // src/parseSfc.ts
218
214
  function advancePosition(position, source, start = 0, end = source.length) {
219
215
  let lines = 0;
220
216
  let lastNewline = -1;
@@ -383,8 +379,7 @@ function updateSfc(sfc, change) {
383
379
  sfc.descriptor.source = source.slice(0, change.start) + change.newText + source.slice(change.end);
384
380
  return sfc;
385
381
  }
386
- //#endregion
387
- //#region src/scriptSetup.ts
382
+ // src/scriptSetup.ts
388
383
  function collectWxsModuleNames(templateContent) {
389
384
  if (!templateContent) return [];
390
385
  const names = /* @__PURE__ */ new Set();
@@ -663,8 +658,7 @@ function createDefineOptionsTemplateDeclarations(code, tsModule, lang) {
663
658
  function resolveScriptSetupLang(lang) {
664
659
  return lang === "js" ? "js" : "ts";
665
660
  }
666
- //#endregion
667
- //#region src/templateRef.ts
661
+ // src/templateRef.ts
668
662
  const SERVICE_SCRIPT_RE = /^script_([jt]sx?)$/;
669
663
  const WHITESPACE_RE = /\s/;
670
664
  const LINE_TERMINATOR_RE = /[\n\r\u2028\u2029]/;
@@ -735,8 +729,7 @@ function createTemplateRefPlugin(baseLib) {
735
729
  }
736
730
  };
737
731
  }
738
- //#endregion
739
- //#region src/index.ts
732
+ // src/index.ts
740
733
  const require = createRequire(typeof module !== "undefined" && module.filename ? module.filename : path.join(process.cwd(), "weapp-vite-volar.cjs"));
741
734
  let hasSchematicsTypes = false;
742
735
  try {
@@ -822,5 +815,4 @@ const plugin = (ctx) => {
822
815
  };
823
816
  return ctx?.vueCompilerOptions ? [parserPlugin, createTemplateRefPlugin(ctx.vueCompilerOptions.lib)] : parserPlugin;
824
817
  };
825
- //#endregion
826
818
  export { plugin as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weapp-vite/volar",
3
- "version": "2.1.14",
3
+ "version": "2.2.0",
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",
@@ -41,14 +41,14 @@
41
41
  "dist"
42
42
  ],
43
43
  "engines": {
44
- "node": "^20.19.0 || >=22.12.0"
44
+ "node": "^22.23.4 || ^24.22.1 || >=26.12.1"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public",
48
48
  "registry": "https://registry.npmjs.org"
49
49
  },
50
50
  "dependencies": {
51
- "@weapp-core/schematics": "6.2.10"
51
+ "@weapp-core/schematics": "6.3.0"
52
52
  },
53
53
  "scripts": {
54
54
  "benchmark": "node --import tsx benchmark/sfc.ts",