@weapp-vite/volar 1.0.0 → 2.0.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.
@@ -1,17 +1,49 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.8_jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js
2
- var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
3
- var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name2 in all)
10
+ __defProp(target, name2, { get: all[name2], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
4
29
 
5
30
  // src/index.ts
6
- var _module = require('module');
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ default: () => index_default
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+ var import_node_module = require("module");
37
+ var import_node_path = __toESM(require("path"));
38
+ var import_node_process = __toESM(require("process"));
7
39
 
8
40
  // package.json
9
41
  var name = "@weapp-vite/volar";
10
42
 
11
43
  // src/schema.ts
12
- var _schematics = require('@weapp-core/schematics');
44
+ var import_schematics = require("@weapp-core/schematics");
13
45
  function getSchemaForType(type) {
14
- const definition = _schematics.JSON_SCHEMA_DEFINITIONS.find((d) => d.typeName === type);
46
+ const definition = import_schematics.JSON_SCHEMA_DEFINITIONS.find((d) => d.typeName === type);
15
47
  if (!definition) {
16
48
  return null;
17
49
  }
@@ -42,12 +74,14 @@ var VOID_CAPABILITIES = {
42
74
  structure: false,
43
75
  format: false
44
76
  };
45
- var require2 = _module.createRequire.call(void 0, importMetaUrl);
77
+ var require2 = (0, import_node_module.createRequire)(
78
+ typeof module !== "undefined" && module.filename ? module.filename : import_node_path.default.join(import_node_process.default.cwd(), "weapp-vite-volar.cjs")
79
+ );
46
80
  var hasSchematicsTypes = false;
47
81
  try {
48
82
  require2.resolve("@weapp-core/schematics");
49
83
  hasSchematicsTypes = true;
50
- } catch (e) {
84
+ } catch {
51
85
  hasSchematicsTypes = false;
52
86
  }
53
87
  function normalizeFilename(filename) {
@@ -138,11 +172,11 @@ ${schemaLine},${content.slice(leftBraceIndex + 1)}`;
138
172
  return `${leading}${injected}${trailing}`;
139
173
  }
140
174
  var plugin = (ctx) => {
141
- let tsModule = _optionalChain([ctx, 'optionalAccess', _2 => _2.modules, 'optionalAccess', _3 => _3.typescript]);
175
+ let tsModule = ctx?.modules?.typescript;
142
176
  if (!tsModule) {
143
177
  try {
144
178
  tsModule = require2("typescript");
145
- } catch (e2) {
179
+ } catch {
146
180
  tsModule = void 0;
147
181
  }
148
182
  }
@@ -264,8 +298,6 @@ var plugin = (ctx) => {
264
298
  };
265
299
  };
266
300
  var index_default = plugin;
267
-
268
-
269
- exports.default = index_default;
270
-
271
- module.exports = exports.default;
301
+ if (typeof module !== "undefined") {
302
+ module.exports = plugin;
303
+ }
package/dist/index.mjs CHANGED
@@ -1,5 +1,7 @@
1
1
  // src/index.ts
2
2
  import { createRequire } from "module";
3
+ import path from "path";
4
+ import process from "process";
3
5
 
4
6
  // package.json
5
7
  var name = "@weapp-vite/volar";
@@ -38,7 +40,9 @@ var VOID_CAPABILITIES = {
38
40
  structure: false,
39
41
  format: false
40
42
  };
41
- var require2 = createRequire(import.meta.url);
43
+ var require2 = createRequire(
44
+ typeof module !== "undefined" && module.filename ? module.filename : path.join(process.cwd(), "weapp-vite-volar.cjs")
45
+ );
42
46
  var hasSchematicsTypes = false;
43
47
  try {
44
48
  require2.resolve("@weapp-core/schematics");
@@ -260,6 +264,9 @@ var plugin = (ctx) => {
260
264
  };
261
265
  };
262
266
  var index_default = plugin;
267
+ if (typeof module !== "undefined") {
268
+ module.exports = plugin;
269
+ }
263
270
  export {
264
271
  index_default as default
265
272
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weapp-vite/volar",
3
- "version": "1.0.0",
3
+ "version": "2.0.1",
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",
@@ -25,22 +25,22 @@
25
25
  "sideEffects": false,
26
26
  "exports": {
27
27
  ".": {
28
- "types": {
29
- "import": "./dist/index.d.mts",
30
- "require": "./dist/index.d.ts"
31
- },
28
+ "types": "./dist/index.d.mts",
32
29
  "import": "./dist/index.mjs",
33
- "require": "./dist/index.js"
30
+ "require": "./dist/index.cjs"
34
31
  }
35
32
  },
36
- "main": "./dist/index.js",
33
+ "main": "./dist/index.cjs",
37
34
  "module": "./dist/index.mjs",
38
- "types": "./dist/index.d.ts",
35
+ "types": "./dist/index.d.mts",
39
36
  "files": [
40
37
  "dist"
41
38
  ],
39
+ "engines": {
40
+ "node": "^20.19.0 || >=22.12.0"
41
+ },
42
42
  "dependencies": {
43
- "@weapp-core/schematics": "5.0.0"
43
+ "@weapp-core/schematics": "6.0.0"
44
44
  },
45
45
  "scripts": {
46
46
  "dev": "tsup --watch --sourcemap",