@vue-jsx-vapor/macros 3.2.13 → 3.2.14

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.
Files changed (69) hide show
  1. package/dist/api.cjs +4 -3
  2. package/dist/api.d.cts +1 -1
  3. package/dist/api.d.ts +1 -1
  4. package/dist/api.js +3 -2
  5. package/dist/astro.cjs +7 -6
  6. package/dist/astro.d.cts +1 -1
  7. package/dist/astro.d.ts +1 -1
  8. package/dist/astro.js +5 -1
  9. package/dist/bun.cjs +8 -6
  10. package/dist/bun.d.cts +1 -1
  11. package/dist/bun.d.ts +1 -1
  12. package/dist/bun.js +5 -1
  13. package/dist/{core-j6kwFyf2.cjs → core-D-SjmK2V.cjs} +98 -76
  14. package/dist/{core-CspOqTxm.js → core-DN_L2oPP.js} +25 -8
  15. package/dist/esbuild.cjs +8 -6
  16. package/dist/esbuild.d.cts +3 -3
  17. package/dist/esbuild.d.ts +3 -3
  18. package/dist/esbuild.js +5 -1
  19. package/dist/index.cjs +10 -9
  20. package/dist/index.d.cts +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.js +6 -2
  23. package/dist/nuxt.cjs +8 -8
  24. package/dist/nuxt.d.cts +3 -3
  25. package/dist/nuxt.d.ts +3 -3
  26. package/dist/nuxt.js +5 -1
  27. package/dist/options.cjs +4 -2
  28. package/dist/options.d.cts +41 -1
  29. package/dist/options.d.ts +41 -1
  30. package/dist/options.js +2 -1
  31. package/dist/raw.cjs +71 -6
  32. package/dist/raw.d.cts +1 -1
  33. package/dist/raw.d.ts +1 -1
  34. package/dist/raw.js +70 -2
  35. package/dist/rolldown.cjs +8 -6
  36. package/dist/rolldown.d.cts +3 -3
  37. package/dist/rolldown.d.ts +3 -3
  38. package/dist/rolldown.js +5 -1
  39. package/dist/rollup.cjs +8 -6
  40. package/dist/rollup.d.cts +3 -3
  41. package/dist/rollup.d.ts +3 -3
  42. package/dist/rollup.js +5 -1
  43. package/dist/rsbuild.cjs +7 -6
  44. package/dist/rsbuild.d.cts +1 -1
  45. package/dist/rsbuild.d.ts +1 -1
  46. package/dist/rsbuild.js +5 -1
  47. package/dist/rspack.cjs +8 -6
  48. package/dist/rspack.d.cts +1 -1
  49. package/dist/rspack.d.ts +1 -1
  50. package/dist/rspack.js +5 -1
  51. package/dist/style-CYbYjV0s.cjs +34 -0
  52. package/dist/style-T_SCIOuW.js +29 -0
  53. package/dist/vite.cjs +8 -6
  54. package/dist/vite.d.cts +3 -3
  55. package/dist/vite.d.ts +3 -3
  56. package/dist/vite.js +5 -1
  57. package/dist/volar.cjs +12 -7
  58. package/dist/volar.d.cts +1 -1
  59. package/dist/volar.d.ts +1 -1
  60. package/dist/volar.js +9 -1
  61. package/dist/webpack.cjs +8 -6
  62. package/dist/webpack.d.cts +3 -3
  63. package/dist/webpack.d.ts +3 -3
  64. package/dist/webpack.js +5 -1
  65. package/package.json +2 -2
  66. package/dist/options-CtTcew0x.d.ts +0 -42
  67. package/dist/options-qs66-MV7.d.cts +0 -42
  68. package/dist/raw-B-nh3eEu.cjs +0 -97
  69. package/dist/raw-CrS9IkfP.js +0 -92
@@ -0,0 +1,34 @@
1
+ const require_core = require('./core-D-SjmK2V.cjs');
2
+
3
+ //#region src/core/style.ts
4
+ let compileStyleAsync;
5
+ async function getCompileStyleAsync() {
6
+ if (compileStyleAsync) return compileStyleAsync;
7
+ const require = require_core.getRequire();
8
+ try {
9
+ return compileStyleAsync = require ? require("vue/compiler-sfc").compileStyleAsync : (await import("https://esm.sh/@vue/compiler-sfc")).compileStyleAsync;
10
+ } catch {}
11
+ }
12
+ async function transformStyle(code, id, options) {
13
+ const query = new URLSearchParams(id.split("?")[1]);
14
+ const compileStyleAsync = await getCompileStyleAsync();
15
+ if (!compileStyleAsync) {
16
+ console.warn(`Cannot require vue/compiler-sfc, please install Vue first.`);
17
+ return "";
18
+ }
19
+ return (await compileStyleAsync({
20
+ filename: id,
21
+ id: `data-v-${query.get("scopeId")}`,
22
+ isProd: options.isProduction,
23
+ source: code,
24
+ scoped: query.get("scoped") === "true"
25
+ })).code;
26
+ }
27
+
28
+ //#endregion
29
+ Object.defineProperty(exports, 'transformStyle', {
30
+ enumerable: true,
31
+ get: function () {
32
+ return transformStyle;
33
+ }
34
+ });
@@ -0,0 +1,29 @@
1
+ import { i as getRequire } from "./core-DN_L2oPP.js";
2
+
3
+ //#region src/core/style.ts
4
+ let compileStyleAsync;
5
+ async function getCompileStyleAsync() {
6
+ if (compileStyleAsync) return compileStyleAsync;
7
+ const require = getRequire();
8
+ try {
9
+ return compileStyleAsync = require ? require("vue/compiler-sfc").compileStyleAsync : (await import("https://esm.sh/@vue/compiler-sfc")).compileStyleAsync;
10
+ } catch {}
11
+ }
12
+ async function transformStyle(code, id, options) {
13
+ const query = new URLSearchParams(id.split("?")[1]);
14
+ const compileStyleAsync = await getCompileStyleAsync();
15
+ if (!compileStyleAsync) {
16
+ console.warn(`Cannot require vue/compiler-sfc, please install Vue first.`);
17
+ return "";
18
+ }
19
+ return (await compileStyleAsync({
20
+ filename: id,
21
+ id: `data-v-${query.get("scopeId")}`,
22
+ isProd: options.isProduction,
23
+ source: code,
24
+ scoped: query.get("scoped") === "true"
25
+ })).code;
26
+ }
27
+
28
+ //#endregion
29
+ export { transformStyle as t };
package/dist/vite.cjs CHANGED
@@ -1,8 +1,10 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ require('./core-D-SjmK2V.cjs');
3
+ require('./style-CYbYjV0s.cjs');
4
+ const require_index = require('./index.cjs');
5
+
5
6
  //#region src/vite.ts
6
- var vite_default = require("./index.cjs").default.vite;
7
+ var vite_default = require_index.default.vite;
8
+
7
9
  //#endregion
8
- exports.default = vite_default;
10
+ exports.default = vite_default;
package/dist/vite.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { n as Options } from "./options-qs66-MV7.cjs";
2
- import * as _$vite from "vite";
1
+ import { Options } from "./options.cjs";
2
+ import * as vite from "vite";
3
3
 
4
4
  //#region src/vite.d.ts
5
- declare const _default: (options?: Options | undefined) => _$vite.Plugin<any> | _$vite.Plugin<any>[];
5
+ declare const _default: (options?: Options | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
6
6
  export = _default;
package/dist/vite.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { n as Options } from "./options-CtTcew0x.js";
2
- import * as _$vite from "vite";
1
+ import { Options } from "./options.js";
2
+ import * as vite from "vite";
3
3
 
4
4
  //#region src/vite.d.ts
5
- declare const _default: (options?: Options | undefined) => _$vite.Plugin<any> | _$vite.Plugin<any>[];
5
+ declare const _default: (options?: Options | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
6
6
  //#endregion
7
7
  export { _default as default };
package/dist/vite.js CHANGED
@@ -1,5 +1,9 @@
1
+ import "./core-DN_L2oPP.js";
2
+ import "./style-T_SCIOuW.js";
1
3
  import unplugin from "./index.js";
4
+
2
5
  //#region src/vite.ts
3
6
  var vite_default = unplugin.vite;
7
+
4
8
  //#endregion
5
- export { vite_default as default };
9
+ export { vite_default as default };
package/dist/volar.cjs CHANGED
@@ -1,11 +1,9 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
5
- require("./core-j6kwFyf2.cjs");
6
- const require_options = require("./options.cjs");
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ const require_core = require('./core-D-SjmK2V.cjs');
3
+ const require_options = require('./options.cjs');
7
4
  let ts_macro = require("ts-macro");
8
5
  let unplugin_utils = require("unplugin-utils");
6
+
9
7
  //#region src/volar/define-component.ts
10
8
  function transformDefineComponent(node, parent, options) {
11
9
  const { codes, ast, ts } = options;
@@ -29,6 +27,7 @@ const __setup = `);
29
27
  slots: ${isVaporComponent ? "__Slots" : `import('vue').SlotsType<__Slots>`}
30
28
  },`, ...compOptions ? ["...", [compOptions.getText(ast), compOptions.getStart(ast)]] : [], `})`, `\n})()`);
31
29
  }
30
+
32
31
  //#endregion
33
32
  //#region src/volar/global-types.ts
34
33
  function getGlobalTypes(rootMap, options) {
@@ -53,6 +52,7 @@ type __ResolveSlots<T> = {
53
52
  };
54
53
  `;
55
54
  }
55
+
56
56
  //#endregion
57
57
  //#region src/volar/define-style.ts
58
58
  function transformDefineStyle({ expression, isCssModules }, index, root, options) {
@@ -114,6 +114,7 @@ function addEmbeddedCode(expression, index, options) {
114
114
  embeddedCodes: []
115
115
  });
116
116
  }
117
+
117
118
  //#endregion
118
119
  //#region src/volar/slot.ts
119
120
  function transformSlot(slotNode, options) {
@@ -144,6 +145,7 @@ function transformSlot(slotNode, options) {
144
145
  codes.replaceRange(slotNode.attributes.pos, slotNode.attributes.end, " {...(__slots = { ...__slots || {}, ", ...nameProp, ": { ", ...props, "}})}");
145
146
  }
146
147
  }
148
+
147
149
  //#endregion
148
150
  //#region src/volar/transform.ts
149
151
  function transformJsxMacros(rootMap, options) {
@@ -196,6 +198,7 @@ return {} as {
196
198
  });
197
199
  }
198
200
  }
201
+
199
202
  //#endregion
200
203
  //#region src/volar/index.ts
201
204
  function getMacro(node, ts, options) {
@@ -317,6 +320,7 @@ function toValidAssetId(name, type) {
317
320
  return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
318
321
  })}`;
319
322
  }
323
+
320
324
  //#endregion
321
325
  //#region src/volar.ts
322
326
  const REGEX_VUE_SFC = /\.vue$/;
@@ -340,6 +344,7 @@ const plugin = (0, ts_macro.createPlugin)(({ ts }, userOptions = {}) => {
340
344
  }
341
345
  };
342
346
  });
347
+
343
348
  //#endregion
344
349
  exports.default = plugin;
345
- exports["module.exports"] = plugin;
350
+ exports["module.exports"] = plugin;
package/dist/volar.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as Options } from "./options-qs66-MV7.cjs";
1
+ import { Options } from "./options.cjs";
2
2
  import { PluginReturn } from "ts-macro";
3
3
 
4
4
  //#region src/volar.d.ts
package/dist/volar.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as Options } from "./options-CtTcew0x.js";
1
+ import { Options } from "./options.js";
2
2
  import { PluginReturn } from "ts-macro";
3
3
 
4
4
  //#region src/volar.d.ts
package/dist/volar.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { resolveOptions } from "./options.js";
2
2
  import { allCodeFeatures, createPlugin, getText } from "ts-macro";
3
3
  import { createFilter } from "unplugin-utils";
4
+
4
5
  //#region src/volar/define-component.ts
5
6
  function transformDefineComponent(node, parent, options) {
6
7
  const { codes, ast, ts } = options;
@@ -24,6 +25,7 @@ const __setup = `);
24
25
  slots: ${isVaporComponent ? "__Slots" : `import('vue').SlotsType<__Slots>`}
25
26
  },`, ...compOptions ? ["...", [compOptions.getText(ast), compOptions.getStart(ast)]] : [], `})`, `\n})()`);
26
27
  }
28
+
27
29
  //#endregion
28
30
  //#region src/volar/global-types.ts
29
31
  function getGlobalTypes(rootMap, options) {
@@ -48,6 +50,7 @@ type __ResolveSlots<T> = {
48
50
  };
49
51
  `;
50
52
  }
53
+
51
54
  //#endregion
52
55
  //#region src/volar/define-style.ts
53
56
  function transformDefineStyle({ expression, isCssModules }, index, root, options) {
@@ -109,6 +112,7 @@ function addEmbeddedCode(expression, index, options) {
109
112
  embeddedCodes: []
110
113
  });
111
114
  }
115
+
112
116
  //#endregion
113
117
  //#region src/volar/slot.ts
114
118
  function transformSlot(slotNode, options) {
@@ -139,6 +143,7 @@ function transformSlot(slotNode, options) {
139
143
  codes.replaceRange(slotNode.attributes.pos, slotNode.attributes.end, " {...(__slots = { ...__slots || {}, ", ...nameProp, ": { ", ...props, "}})}");
140
144
  }
141
145
  }
146
+
142
147
  //#endregion
143
148
  //#region src/volar/transform.ts
144
149
  function transformJsxMacros(rootMap, options) {
@@ -191,6 +196,7 @@ return {} as {
191
196
  });
192
197
  }
193
198
  }
199
+
194
200
  //#endregion
195
201
  //#region src/volar/index.ts
196
202
  function getMacro(node, ts, options) {
@@ -312,6 +318,7 @@ function toValidAssetId(name, type) {
312
318
  return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
313
319
  })}`;
314
320
  }
321
+
315
322
  //#endregion
316
323
  //#region src/volar.ts
317
324
  const REGEX_VUE_SFC = /\.vue$/;
@@ -335,5 +342,6 @@ const plugin = createPlugin(({ ts }, userOptions = {}) => {
335
342
  }
336
343
  };
337
344
  });
345
+
338
346
  //#endregion
339
- export { plugin as default, plugin as "module.exports" };
347
+ export { plugin as default, plugin as "module.exports" };
package/dist/webpack.cjs CHANGED
@@ -1,8 +1,10 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ require('./core-D-SjmK2V.cjs');
3
+ require('./style-CYbYjV0s.cjs');
4
+ const require_index = require('./index.cjs');
5
+
5
6
  //#region src/webpack.ts
6
- var webpack_default = require("./index.cjs").default.webpack;
7
+ var webpack_default = require_index.default.webpack;
8
+
7
9
  //#endregion
8
- exports.default = webpack_default;
10
+ exports.default = webpack_default;
@@ -1,6 +1,6 @@
1
- import { n as Options } from "./options-qs66-MV7.cjs";
2
- import * as _$webpack from "webpack";
1
+ import { Options } from "./options.cjs";
2
+ import * as webpack from "webpack";
3
3
 
4
4
  //#region src/webpack.d.ts
5
- declare const _default: (options?: Options | undefined) => _$webpack.WebpackPluginInstance;
5
+ declare const _default: (options?: Options | undefined) => webpack.WebpackPluginInstance;
6
6
  export = _default;
package/dist/webpack.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { n as Options } from "./options-CtTcew0x.js";
2
- import * as _$webpack from "webpack";
1
+ import { Options } from "./options.js";
2
+ import * as webpack from "webpack";
3
3
 
4
4
  //#region src/webpack.d.ts
5
- declare const _default: (options?: Options | undefined) => _$webpack.WebpackPluginInstance;
5
+ declare const _default: (options?: Options | undefined) => webpack.WebpackPluginInstance;
6
6
  //#endregion
7
7
  export { _default as default };
package/dist/webpack.js CHANGED
@@ -1,5 +1,9 @@
1
+ import "./core-DN_L2oPP.js";
2
+ import "./style-T_SCIOuW.js";
1
3
  import unplugin from "./index.js";
4
+
2
5
  //#region src/webpack.ts
3
6
  var webpack_default = unplugin.webpack;
7
+
4
8
  //#endregion
5
- export { webpack_default as default };
9
+ export { webpack_default as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vue-jsx-vapor/macros",
3
3
  "type": "module",
4
- "version": "3.2.13",
4
+ "version": "3.2.14",
5
5
  "description": "Macros for Vue JSX Vapor",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/vuejs/vue-jsx-vapor#readme",
@@ -157,7 +157,7 @@
157
157
  "@nuxt/schema": "^3.21.4",
158
158
  "@types/hash-sum": "^1.0.2",
159
159
  "ast-kit": "^2.2.0",
160
- "vue": "3.6.0-beta.8"
160
+ "vue": "3.6.0-beta.10"
161
161
  },
162
162
  "scripts": {
163
163
  "build": "tsdown",
@@ -1,42 +0,0 @@
1
- import { FilterPattern } from "unplugin";
2
-
3
- //#region src/options.d.ts
4
- interface BaseOptions {
5
- include?: FilterPattern;
6
- exclude?: FilterPattern;
7
- version?: number;
8
- isProduction?: boolean;
9
- }
10
- type MarkRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
11
- type DefineComponentOptions = {
12
- alias?: string[];
13
- };
14
- type DefineModelOptions = {
15
- alias?: string[];
16
- };
17
- type DefineExposeOptions = {
18
- alias?: string[];
19
- };
20
- type DefineSlotsOptions = {
21
- alias?: string[];
22
- };
23
- type DefineStyleOptions = {
24
- alias?: string[];
25
- };
26
- type Options = BaseOptions & {
27
- defineComponent?: DefineComponentOptions;
28
- defineModel?: DefineModelOptions;
29
- defineExpose?: DefineExposeOptions;
30
- defineSlots?: DefineSlotsOptions;
31
- defineStyle?: DefineStyleOptions;
32
- };
33
- type OptionsResolved = MarkRequired<Options, 'include' | 'version'> & {
34
- defineComponent: MarkRequired<DefineComponentOptions, 'alias'>;
35
- defineModel: MarkRequired<DefineModelOptions, 'alias'>;
36
- defineExpose: MarkRequired<DefineExposeOptions, 'alias'>;
37
- defineSlots: MarkRequired<DefineSlotsOptions, 'alias'>;
38
- defineStyle: MarkRequired<DefineStyleOptions, 'alias'>;
39
- };
40
- declare function resolveOptions(options: Options): OptionsResolved;
41
- //#endregion
42
- export { resolveOptions as i, Options as n, OptionsResolved as r, BaseOptions as t };
@@ -1,42 +0,0 @@
1
- import { FilterPattern } from "unplugin";
2
-
3
- //#region src/options.d.ts
4
- interface BaseOptions {
5
- include?: FilterPattern;
6
- exclude?: FilterPattern;
7
- version?: number;
8
- isProduction?: boolean;
9
- }
10
- type MarkRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
11
- type DefineComponentOptions = {
12
- alias?: string[];
13
- };
14
- type DefineModelOptions = {
15
- alias?: string[];
16
- };
17
- type DefineExposeOptions = {
18
- alias?: string[];
19
- };
20
- type DefineSlotsOptions = {
21
- alias?: string[];
22
- };
23
- type DefineStyleOptions = {
24
- alias?: string[];
25
- };
26
- type Options = BaseOptions & {
27
- defineComponent?: DefineComponentOptions;
28
- defineModel?: DefineModelOptions;
29
- defineExpose?: DefineExposeOptions;
30
- defineSlots?: DefineSlotsOptions;
31
- defineStyle?: DefineStyleOptions;
32
- };
33
- type OptionsResolved = MarkRequired<Options, 'include' | 'version'> & {
34
- defineComponent: MarkRequired<DefineComponentOptions, 'alias'>;
35
- defineModel: MarkRequired<DefineModelOptions, 'alias'>;
36
- defineExpose: MarkRequired<DefineExposeOptions, 'alias'>;
37
- defineSlots: MarkRequired<DefineSlotsOptions, 'alias'>;
38
- defineStyle: MarkRequired<DefineStyleOptions, 'alias'>;
39
- };
40
- declare function resolveOptions(options: Options): OptionsResolved;
41
- //#endregion
42
- export { resolveOptions as i, Options as n, OptionsResolved as r, BaseOptions as t };
@@ -1,97 +0,0 @@
1
- const require_core = require("./core-j6kwFyf2.cjs");
2
- const require_options = require("./options.cjs");
3
- //#region src/core/style.ts
4
- let compileStyleAsync;
5
- async function getCompileStyleAsync() {
6
- if (compileStyleAsync) return compileStyleAsync;
7
- const require = require_core.getRequire();
8
- try {
9
- return compileStyleAsync = require ? require("vue/compiler-sfc").compileStyleAsync : (await import("https://esm.sh/@vue/compiler-sfc")).compileStyleAsync;
10
- } catch {}
11
- }
12
- async function transformStyle(code, id, options) {
13
- const query = new URLSearchParams(id.split("?")[1]);
14
- const compileStyleAsync = await getCompileStyleAsync();
15
- if (!compileStyleAsync) {
16
- console.warn(`Cannot require vue/compiler-sfc, please install Vue first.`);
17
- return "";
18
- }
19
- return (await compileStyleAsync({
20
- filename: id,
21
- id: `data-v-${query.get("scopeId")}`,
22
- isProd: options.isProduction,
23
- source: code,
24
- scoped: query.get("scoped") === "true"
25
- })).code;
26
- }
27
- //#endregion
28
- //#region src/raw.ts
29
- const plugin = (userOptions = {}) => {
30
- const options = require_options.resolveOptions(userOptions);
31
- const importMap = /* @__PURE__ */ new Map();
32
- const macrosHelperId = /^\/vue-jsx-vapor\/macros\//;
33
- const defineStyleHelperId = /^\/vue-jsx-vapor\/macros\/define-style/;
34
- return [{
35
- name: "@vue-jsx-vapor/macros",
36
- enforce: "pre",
37
- resolveId: {
38
- filter: { id: macrosHelperId },
39
- handler(id) {
40
- return id;
41
- }
42
- },
43
- load: {
44
- filter: { id: macrosHelperId },
45
- handler(id) {
46
- if (id === require_core.useModelHelperId) return require_core.use_model_default;
47
- if (id === require_core.withDefaultsHelperId) return require_core.with_defaults_default;
48
- if (id === require_core.useSlotsHelperId) return require_core.use_slots_default;
49
- }
50
- },
51
- transform: {
52
- filter: {
53
- id: {
54
- include: options.include,
55
- exclude: options.exclude
56
- },
57
- code: [
58
- ...options.defineComponent.alias,
59
- ...options.defineExpose.alias,
60
- ...options.defineModel.alias,
61
- ...options.defineSlots.alias,
62
- ...options.defineStyle.alias
63
- ]
64
- },
65
- handler(code, id) {
66
- return require_core.transformJsxMacros(code, id, importMap, options);
67
- }
68
- }
69
- }, {
70
- name: "@vue-jsx-vapor/macros/define-style",
71
- resolveId: {
72
- filter: { id: defineStyleHelperId },
73
- handler(id) {
74
- return id;
75
- }
76
- },
77
- load: {
78
- filter: { id: defineStyleHelperId },
79
- handler(id) {
80
- return importMap.get(id);
81
- }
82
- },
83
- transform: {
84
- filter: { id: defineStyleHelperId },
85
- handler(code, id) {
86
- return transformStyle(code, id, options);
87
- }
88
- }
89
- }];
90
- };
91
- //#endregion
92
- Object.defineProperty(exports, "plugin", {
93
- enumerable: true,
94
- get: function() {
95
- return plugin;
96
- }
97
- });
@@ -1,92 +0,0 @@
1
- import { c as withDefaultsHelperId, d as use_model_default, i as getRequire, l as with_defaults_default, n as transformJsxMacros, o as useModelHelperId, s as useSlotsHelperId, u as use_slots_default } from "./core-CspOqTxm.js";
2
- import { resolveOptions } from "./options.js";
3
- //#region src/core/style.ts
4
- let compileStyleAsync;
5
- async function getCompileStyleAsync() {
6
- if (compileStyleAsync) return compileStyleAsync;
7
- const require = getRequire();
8
- try {
9
- return compileStyleAsync = require ? require("vue/compiler-sfc").compileStyleAsync : (await import("https://esm.sh/@vue/compiler-sfc")).compileStyleAsync;
10
- } catch {}
11
- }
12
- async function transformStyle(code, id, options) {
13
- const query = new URLSearchParams(id.split("?")[1]);
14
- const compileStyleAsync = await getCompileStyleAsync();
15
- if (!compileStyleAsync) {
16
- console.warn(`Cannot require vue/compiler-sfc, please install Vue first.`);
17
- return "";
18
- }
19
- return (await compileStyleAsync({
20
- filename: id,
21
- id: `data-v-${query.get("scopeId")}`,
22
- isProd: options.isProduction,
23
- source: code,
24
- scoped: query.get("scoped") === "true"
25
- })).code;
26
- }
27
- //#endregion
28
- //#region src/raw.ts
29
- const plugin = (userOptions = {}) => {
30
- const options = resolveOptions(userOptions);
31
- const importMap = /* @__PURE__ */ new Map();
32
- const macrosHelperId = /^\/vue-jsx-vapor\/macros\//;
33
- const defineStyleHelperId = /^\/vue-jsx-vapor\/macros\/define-style/;
34
- return [{
35
- name: "@vue-jsx-vapor/macros",
36
- enforce: "pre",
37
- resolveId: {
38
- filter: { id: macrosHelperId },
39
- handler(id) {
40
- return id;
41
- }
42
- },
43
- load: {
44
- filter: { id: macrosHelperId },
45
- handler(id) {
46
- if (id === useModelHelperId) return use_model_default;
47
- if (id === withDefaultsHelperId) return with_defaults_default;
48
- if (id === useSlotsHelperId) return use_slots_default;
49
- }
50
- },
51
- transform: {
52
- filter: {
53
- id: {
54
- include: options.include,
55
- exclude: options.exclude
56
- },
57
- code: [
58
- ...options.defineComponent.alias,
59
- ...options.defineExpose.alias,
60
- ...options.defineModel.alias,
61
- ...options.defineSlots.alias,
62
- ...options.defineStyle.alias
63
- ]
64
- },
65
- handler(code, id) {
66
- return transformJsxMacros(code, id, importMap, options);
67
- }
68
- }
69
- }, {
70
- name: "@vue-jsx-vapor/macros/define-style",
71
- resolveId: {
72
- filter: { id: defineStyleHelperId },
73
- handler(id) {
74
- return id;
75
- }
76
- },
77
- load: {
78
- filter: { id: defineStyleHelperId },
79
- handler(id) {
80
- return importMap.get(id);
81
- }
82
- },
83
- transform: {
84
- filter: { id: defineStyleHelperId },
85
- handler(code, id) {
86
- return transformStyle(code, id, options);
87
- }
88
- }
89
- }];
90
- };
91
- //#endregion
92
- export { plugin as t };