@vue-jsx/macros 3.3.0-beta.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.
@@ -0,0 +1,7 @@
1
+ import { n as Options } from "./options-CtTcew0x.js";
2
+ import * as _$esbuild from "esbuild";
3
+
4
+ //#region src/esbuild.d.ts
5
+ declare const _default: (options?: Options | undefined) => _$esbuild.Plugin;
6
+ //#endregion
7
+ export { _default as default };
@@ -0,0 +1,5 @@
1
+ import unplugin from "./index.js";
2
+ //#region src/esbuild.ts
3
+ var esbuild_default = unplugin.esbuild;
4
+ //#endregion
5
+ export { esbuild_default as default };
@@ -0,0 +1,7 @@
1
+ import { i as resolveOptions, n as Options, r as OptionsResolved, t as BaseOptions } from "./options-CtTcew0x.js";
2
+ import { UnpluginInstance } from "unplugin";
3
+
4
+ //#region src/index.d.ts
5
+ declare const unplugin: UnpluginInstance<Options | undefined>;
6
+ //#endregion
7
+ export { BaseOptions, Options, OptionsResolved, unplugin as default, resolveOptions };
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ import { t as plugin } from "./raw-Qfl50r_v.js";
2
+ import { resolveOptions } from "./options.js";
3
+ import { createUnplugin } from "unplugin";
4
+ //#region src/index.ts
5
+ const unplugin = createUnplugin(plugin);
6
+ //#endregion
7
+ export { unplugin as default, resolveOptions };
package/dist/nuxt.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { n as Options } from "./options-CtTcew0x.js";
2
+ import * as _$_nuxt_schema0 from "@nuxt/schema";
3
+
4
+ //#region src/nuxt.d.ts
5
+ interface ModuleOptions extends Options {}
6
+ declare const _default: _$_nuxt_schema0.NuxtModule<ModuleOptions, ModuleOptions, false>;
7
+ //#endregion
8
+ export { ModuleOptions, _default as default };
package/dist/nuxt.js ADDED
@@ -0,0 +1,17 @@
1
+ import vite_default from "./vite.js";
2
+ import webpack_default from "./webpack.js";
3
+ import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
4
+ import "@nuxt/schema";
5
+ //#region src/nuxt.ts
6
+ var nuxt_default = defineNuxtModule({
7
+ meta: {
8
+ name: "nuxt-vue-jsx-vapor-macros",
9
+ configKey: "unpluginStarter"
10
+ },
11
+ setup(options) {
12
+ addVitePlugin(() => vite_default(options));
13
+ addWebpackPlugin(() => webpack_default(options));
14
+ }
15
+ });
16
+ //#endregion
17
+ export { nuxt_default as default };
@@ -0,0 +1,42 @@
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 };
@@ -0,0 +1,2 @@
1
+ import { i as resolveOptions, n as Options, r as OptionsResolved, t as BaseOptions } from "./options-CtTcew0x.js";
2
+ export { BaseOptions, Options, OptionsResolved, resolveOptions };
@@ -0,0 +1,28 @@
1
+ //#region src/options.ts
2
+ const REGEX_NODE_MODULES = /node_modules/;
3
+ const REGEX_SRC_FILE = /\.[cm]?[jt]sx?$/;
4
+ const REGEX_SETUP_SFC = /\.setup\.[cm]?[jt]sx?$/;
5
+ function resolveOptions(options) {
6
+ const version = options.version || 3.6;
7
+ return {
8
+ include: [REGEX_SRC_FILE],
9
+ exclude: [REGEX_SETUP_SFC, REGEX_NODE_MODULES],
10
+ ...options,
11
+ version,
12
+ defineComponent: {
13
+ ...options.defineComponent,
14
+ alias: options.defineComponent?.alias ?? [
15
+ "defineComponent",
16
+ "defineVaporComponent",
17
+ "defineCustomElement",
18
+ "defineVaporCustomElement"
19
+ ]
20
+ },
21
+ defineModel: { alias: options.defineModel?.alias ?? ["defineModel"] },
22
+ defineSlots: { alias: options.defineSlots?.alias ?? ["defineSlots"] },
23
+ defineExpose: { alias: options.defineExpose?.alias ?? ["defineExpose"] },
24
+ defineStyle: { alias: options.defineStyle?.alias ?? ["defineStyle"] }
25
+ };
26
+ }
27
+ //#endregion
28
+ export { resolveOptions };
@@ -0,0 +1,92 @@
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-BRE2gjfq.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/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/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 };
package/dist/raw.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { n as Options } from "./options-CtTcew0x.js";
2
+ import { UnpluginOptions } from "unplugin";
3
+
4
+ //#region src/raw.d.ts
5
+ declare const plugin: (userOptions?: Options) => UnpluginOptions[];
6
+ //#endregion
7
+ export { plugin as default };
package/dist/raw.js ADDED
@@ -0,0 +1,2 @@
1
+ import { t as plugin } from "./raw-Qfl50r_v.js";
2
+ export { plugin as default };
@@ -0,0 +1,7 @@
1
+ import { n as Options } from "./options-CtTcew0x.js";
2
+ import * as _$unplugin from "unplugin";
3
+
4
+ //#region src/rolldown.d.ts
5
+ declare const _default: (options?: Options | undefined) => _$unplugin.RolldownPlugin<any>[] | _$unplugin.RolldownPlugin<any>;
6
+ //#endregion
7
+ export { _default as default };
@@ -0,0 +1,5 @@
1
+ import unplugin from "./index.js";
2
+ //#region src/rolldown.ts
3
+ var rolldown_default = unplugin.rolldown;
4
+ //#endregion
5
+ export { rolldown_default as default };
@@ -0,0 +1,7 @@
1
+ import { n as Options } from "./options-CtTcew0x.js";
2
+ import * as _$rollup from "rollup";
3
+
4
+ //#region src/rollup.d.ts
5
+ declare const _default: (options?: Options | undefined) => _$rollup.Plugin<any>[] | _$rollup.Plugin<any>;
6
+ //#endregion
7
+ export { _default as default };
package/dist/rollup.js ADDED
@@ -0,0 +1,5 @@
1
+ import unplugin from "./index.js";
2
+ //#region src/rollup.ts
3
+ var rollup_default = unplugin.rollup;
4
+ //#endregion
5
+ export { rollup_default as default };
@@ -0,0 +1,9 @@
1
+ import { n as Options } from "./options-CtTcew0x.js";
2
+
3
+ //#region src/rsbuild.d.ts
4
+ declare const _default: (options?: Options) => {
5
+ name: string;
6
+ setup(api: any): void;
7
+ };
8
+ //#endregion
9
+ export { _default as default };
@@ -0,0 +1,12 @@
1
+ import unplugin from "./index.js";
2
+ //#region src/rsbuild.ts
3
+ var rsbuild_default = (options = {}) => ({
4
+ name: "rsbuild:vue-jsx-vapor-macros",
5
+ setup(api) {
6
+ api.modifyBundlerChain((chain) => {
7
+ chain.plugin("vue-jsx-vapor-macros").use(unplugin.rspack(options));
8
+ });
9
+ }
10
+ });
11
+ //#endregion
12
+ export { rsbuild_default as default };
@@ -0,0 +1,6 @@
1
+ import { n as Options } from "./options-CtTcew0x.js";
2
+
3
+ //#region src/rspack.d.ts
4
+ declare const _default: (options?: Options | undefined) => RspackPluginInstance;
5
+ //#endregion
6
+ export { _default as default };
package/dist/rspack.js ADDED
@@ -0,0 +1,5 @@
1
+ import unplugin from "./index.js";
2
+ //#region src/rspack.ts
3
+ var rspack_default = unplugin.rspack;
4
+ //#endregion
5
+ export { rspack_default as default };
package/dist/vite.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { n as Options } from "./options-CtTcew0x.js";
2
+ import * as _$vite from "vite";
3
+
4
+ //#region src/vite.d.ts
5
+ declare const _default: (options?: Options | undefined) => _$vite.Plugin<any>[] | _$vite.Plugin<any>;
6
+ //#endregion
7
+ export { _default as default };
package/dist/vite.js ADDED
@@ -0,0 +1,5 @@
1
+ import unplugin from "./index.js";
2
+ //#region src/vite.ts
3
+ var vite_default = unplugin.vite;
4
+ //#endregion
5
+ export { vite_default as default };
@@ -0,0 +1,11 @@
1
+ import { n as Options } from "./options-CtTcew0x.js";
2
+ import * as _$ts_macro0 from "ts-macro";
3
+ import { PluginReturn } from "ts-macro";
4
+
5
+ //#region src/volar/jsx-element.d.ts
6
+ declare const _default: _$ts_macro0.PluginReturn<unknown, boolean>;
7
+ //#endregion
8
+ //#region src/volar.d.ts
9
+ declare const plugin: PluginReturn<Options | undefined>;
10
+ //#endregion
11
+ export { plugin as default, plugin as "module.exports", _default as jsxElement };