@vue-jsx-vapor/macros 2.0.1 → 2.1.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/volar.cjs CHANGED
@@ -10,7 +10,6 @@ var _tsmacro = require('ts-macro');
10
10
 
11
11
 
12
12
 
13
- var _compilerdom = require('@vue/compiler-dom');
14
13
 
15
14
 
16
15
  // src/volar/define-component.ts
@@ -214,9 +213,7 @@ ${defineStyle}
214
213
  type ${_common.HELPER_PREFIX}StyleArgs = [style: string, options?: { scoped?: boolean }];
215
214
  type ${_common.HELPER_PREFIX}PrettifyLocal<T> = { [K in keyof T]: T[K]; } & {};
216
215
  // @ts-ignore
217
- type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
218
- // @ts-ignore
219
- type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
216
+ type __VLS_IsAny<T> = 0 extends 1 & T ? true : false; type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
220
217
  `;
221
218
  }
222
219
 
@@ -322,7 +319,7 @@ function getRootMap(options) {
322
319
  `${!expression.arguments.hasTrailingComma && expression.arguments.length ? "," : ""} { required: true }`
323
320
  );
324
321
  }
325
- const id = _compilerdom.toValidAssetId.call(void 0, modelName, `${_common.HELPER_PREFIX}model`);
322
+ const id = toValidAssetId(modelName, `${_common.HELPER_PREFIX}model`);
326
323
  const typeString = `import('vue').UnwrapRef<typeof ${id}>`;
327
324
  (rootMap.get(root).defineModel ??= []).push(
328
325
  `${modelName.includes("-") ? `'${modelName}'` : modelName}${isRequired ? ":" : "?:"} ${typeString}`,
@@ -361,6 +358,11 @@ const ${_common.HELPER_PREFIX}exposed = `
361
358
  ts.forEachChild(ast, (node) => walk(node, []));
362
359
  return rootMap;
363
360
  }
361
+ function toValidAssetId(name, type) {
362
+ return `_${type}_${name.replaceAll(/\W/g, (searchValue, replaceValue) => {
363
+ return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
364
+ })}`;
365
+ }
364
366
 
365
367
  // src/volar.ts
366
368
  var plugin = _tsmacro.createPlugin.call(void 0,
package/dist/volar.js CHANGED
@@ -10,7 +10,6 @@ import { createPlugin } from "ts-macro";
10
10
  import {
11
11
  HELPER_PREFIX as HELPER_PREFIX4
12
12
  } from "@vue-macros/common";
13
- import { toValidAssetId } from "@vue/compiler-dom";
14
13
  import { replaceRange as replaceRange4 } from "ts-macro";
15
14
 
16
15
  // src/volar/define-component.ts
@@ -214,9 +213,7 @@ ${defineStyle}
214
213
  type ${HELPER_PREFIX3}StyleArgs = [style: string, options?: { scoped?: boolean }];
215
214
  type ${HELPER_PREFIX3}PrettifyLocal<T> = { [K in keyof T]: T[K]; } & {};
216
215
  // @ts-ignore
217
- type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
218
- // @ts-ignore
219
- type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
216
+ type __VLS_IsAny<T> = 0 extends 1 & T ? true : false; type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
220
217
  `;
221
218
  }
222
219
 
@@ -361,6 +358,11 @@ const ${HELPER_PREFIX4}exposed = `
361
358
  ts.forEachChild(ast, (node) => walk(node, []));
362
359
  return rootMap;
363
360
  }
361
+ function toValidAssetId(name, type) {
362
+ return `_${type}_${name.replaceAll(/\W/g, (searchValue, replaceValue) => {
363
+ return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
364
+ })}`;
365
+ }
364
366
 
365
367
  // src/volar.ts
366
368
  var plugin = createPlugin(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-jsx-vapor/macros",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "Macros for Vue JSX Vapor",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -168,11 +168,10 @@
168
168
  },
169
169
  "dependencies": {
170
170
  "@vue-macros/common": "3.0.0-beta.4",
171
- "@vue/compiler-dom": "https://pkg.pr.new/@vue/compiler-dom@ce35a8c",
172
- "@vue/compiler-sfc": "https://pkg.pr.new/@vue/compiler-sfc@ce35a8c",
171
+ "@vue/compiler-sfc": "https://pkg.pr.new/@vue/compiler-sfc@34957eb",
173
172
  "@vue/language-core": "^2.2.8",
174
173
  "hash-sum": "^2.0.0",
175
- "ts-macro": "0.1.21",
174
+ "ts-macro": "^0.1.25",
176
175
  "unplugin": "^1.16.1"
177
176
  },
178
177
  "devDependencies": {
@@ -181,7 +180,7 @@
181
180
  "@nuxt/schema": "^3.16.0",
182
181
  "@types/hash-sum": "^1.0.2",
183
182
  "@vue-macros/test-utils": "3.0.0-beta.4",
184
- "vue": "https://pkg.pr.new/vue@ce35a8c"
183
+ "vue": "https://pkg.pr.new/vue@34957eb"
185
184
  },
186
185
  "scripts": {
187
186
  "build": "tsup",