@vue-jsx-vapor/macros 3.2.11 → 3.2.12
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/api.cjs +3 -3
- package/dist/api.d.cts +5 -5
- package/dist/api.d.ts +5 -5
- package/dist/api.js +2 -3
- package/dist/astro.cjs +7 -8
- package/dist/astro.d.cts +1 -1
- package/dist/astro.d.ts +1 -1
- package/dist/astro.js +3 -7
- package/dist/bun.cjs +6 -8
- package/dist/bun.d.cts +1 -1
- package/dist/bun.d.ts +1 -1
- package/dist/bun.js +3 -7
- package/dist/{core-Qf0K0TQC.js → core-CspOqTxm.js} +9 -26
- package/dist/{core-CyGS7Va2.cjs → core-j6kwFyf2.cjs} +78 -100
- package/dist/esbuild.cjs +6 -8
- package/dist/esbuild.d.cts +3 -3
- package/dist/esbuild.d.ts +3 -3
- package/dist/esbuild.js +3 -7
- package/dist/index.cjs +12 -8
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -6
- package/dist/nuxt.cjs +8 -9
- package/dist/nuxt.d.cts +3 -3
- package/dist/nuxt.d.ts +3 -3
- package/dist/nuxt.js +1 -6
- package/dist/options.cjs +29 -3
- package/dist/options.d.cts +1 -1
- package/dist/options.d.ts +1 -1
- package/dist/options.js +28 -3
- package/dist/{raw-C-xS65ku.cjs → raw-B-nh3eEu.cjs} +8 -12
- package/dist/{raw-BTUP7Cbc.js → raw-CrS9IkfP.js} +3 -7
- package/dist/raw.cjs +6 -5
- package/dist/raw.d.cts +1 -1
- package/dist/raw.d.ts +1 -1
- package/dist/raw.js +2 -4
- package/dist/rolldown.cjs +6 -8
- package/dist/rolldown.d.cts +3 -3
- package/dist/rolldown.d.ts +3 -3
- package/dist/rolldown.js +3 -7
- package/dist/rollup.cjs +6 -8
- package/dist/rollup.d.cts +3 -3
- package/dist/rollup.d.ts +3 -3
- package/dist/rollup.js +3 -7
- package/dist/rspack.cjs +6 -8
- package/dist/rspack.d.cts +1 -1
- package/dist/rspack.d.ts +1 -1
- package/dist/rspack.js +3 -7
- package/dist/vite.cjs +6 -8
- package/dist/vite.d.cts +3 -3
- package/dist/vite.d.ts +3 -3
- package/dist/vite.js +3 -7
- package/dist/volar.cjs +8 -14
- package/dist/volar.d.cts +1 -1
- package/dist/volar.d.ts +1 -1
- package/dist/volar.js +2 -11
- package/dist/webpack.cjs +6 -8
- package/dist/webpack.d.cts +3 -3
- package/dist/webpack.d.ts +3 -3
- package/dist/webpack.js +3 -7
- package/package.json +29 -29
- package/dist/options-BMD1qLwt.cjs +0 -35
- package/dist/options-CmJjcwvr.js +0 -29
- package/dist/src-BoqluMMt.js +0 -9
- package/dist/src-Qjj50LHy.cjs +0 -15
- /package/dist/{options-BOh4R4y_.d.cts → options-CtTcew0x.d.ts} +0 -0
- /package/dist/{options-BV2zYeKi.d.ts → options-qs66-MV7.d.cts} +0 -0
package/dist/api.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_core = require("./core-j6kwFyf2.cjs");
|
|
3
3
|
exports.getMacroExpression = require_core.getMacroExpression;
|
|
4
4
|
exports.isFunctionalNode = require_core.isFunctionalNode;
|
|
5
5
|
exports.restructure = require_core.restructure;
|
|
6
|
-
exports.transformJsxMacros = require_core.transformJsxMacros;
|
|
6
|
+
exports.transformJsxMacros = require_core.transformJsxMacros;
|
package/dist/api.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as OptionsResolved } from "./options-
|
|
1
|
+
import { r as OptionsResolved } from "./options-qs66-MV7.cjs";
|
|
2
2
|
import MagicString from "magic-string";
|
|
3
3
|
|
|
4
|
-
//#region ../../node_modules/.pnpm/@babel+types@7.
|
|
4
|
+
//#region ../../node_modules/.pnpm/@babel+types@7.29.0/node_modules/@babel/types/lib/index-legacy.d.ts
|
|
5
5
|
// NOTE: This file is autogenerated. Do not modify.
|
|
6
6
|
// See packages/babel-types/scripts/generators/typescript-legacy.ts for script used.
|
|
7
7
|
interface BaseComment {
|
|
@@ -380,8 +380,8 @@ interface ClassDeclaration extends BaseNode {
|
|
|
380
380
|
interface ExportAllDeclaration extends BaseNode {
|
|
381
381
|
type: "ExportAllDeclaration";
|
|
382
382
|
source: StringLiteral;
|
|
383
|
-
assertions: ImportAttribute[] | null;
|
|
384
383
|
attributes: ImportAttribute[] | null;
|
|
384
|
+
assertions: ImportAttribute[] | null;
|
|
385
385
|
exportKind: "type" | "value" | null;
|
|
386
386
|
}
|
|
387
387
|
interface ExportDefaultDeclaration extends BaseNode {
|
|
@@ -394,8 +394,8 @@ interface ExportNamedDeclaration extends BaseNode {
|
|
|
394
394
|
declaration: Declaration | null;
|
|
395
395
|
specifiers: (ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier)[];
|
|
396
396
|
source: StringLiteral | null;
|
|
397
|
-
assertions: ImportAttribute[] | null;
|
|
398
397
|
attributes: ImportAttribute[] | null;
|
|
398
|
+
assertions: ImportAttribute[] | null;
|
|
399
399
|
exportKind: "type" | "value" | null;
|
|
400
400
|
}
|
|
401
401
|
interface ExportSpecifier extends BaseNode {
|
|
@@ -415,8 +415,8 @@ interface ImportDeclaration extends BaseNode {
|
|
|
415
415
|
type: "ImportDeclaration";
|
|
416
416
|
specifiers: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[];
|
|
417
417
|
source: StringLiteral;
|
|
418
|
-
assertions: ImportAttribute[] | null;
|
|
419
418
|
attributes: ImportAttribute[] | null;
|
|
419
|
+
assertions: ImportAttribute[] | null;
|
|
420
420
|
importKind: "type" | "typeof" | "value" | null;
|
|
421
421
|
module: boolean | null;
|
|
422
422
|
phase: "source" | "defer" | null;
|
package/dist/api.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as OptionsResolved } from "./options-
|
|
1
|
+
import { r as OptionsResolved } from "./options-CtTcew0x.js";
|
|
2
2
|
import MagicString from "magic-string";
|
|
3
3
|
|
|
4
|
-
//#region ../../node_modules/.pnpm/@babel+types@7.
|
|
4
|
+
//#region ../../node_modules/.pnpm/@babel+types@7.29.0/node_modules/@babel/types/lib/index-legacy.d.ts
|
|
5
5
|
// NOTE: This file is autogenerated. Do not modify.
|
|
6
6
|
// See packages/babel-types/scripts/generators/typescript-legacy.ts for script used.
|
|
7
7
|
interface BaseComment {
|
|
@@ -380,8 +380,8 @@ interface ClassDeclaration extends BaseNode {
|
|
|
380
380
|
interface ExportAllDeclaration extends BaseNode {
|
|
381
381
|
type: "ExportAllDeclaration";
|
|
382
382
|
source: StringLiteral;
|
|
383
|
-
assertions: ImportAttribute[] | null;
|
|
384
383
|
attributes: ImportAttribute[] | null;
|
|
384
|
+
assertions: ImportAttribute[] | null;
|
|
385
385
|
exportKind: "type" | "value" | null;
|
|
386
386
|
}
|
|
387
387
|
interface ExportDefaultDeclaration extends BaseNode {
|
|
@@ -394,8 +394,8 @@ interface ExportNamedDeclaration extends BaseNode {
|
|
|
394
394
|
declaration: Declaration | null;
|
|
395
395
|
specifiers: (ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier)[];
|
|
396
396
|
source: StringLiteral | null;
|
|
397
|
-
assertions: ImportAttribute[] | null;
|
|
398
397
|
attributes: ImportAttribute[] | null;
|
|
398
|
+
assertions: ImportAttribute[] | null;
|
|
399
399
|
exportKind: "type" | "value" | null;
|
|
400
400
|
}
|
|
401
401
|
interface ExportSpecifier extends BaseNode {
|
|
@@ -415,8 +415,8 @@ interface ImportDeclaration extends BaseNode {
|
|
|
415
415
|
type: "ImportDeclaration";
|
|
416
416
|
specifiers: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[];
|
|
417
417
|
source: StringLiteral;
|
|
418
|
-
assertions: ImportAttribute[] | null;
|
|
419
418
|
attributes: ImportAttribute[] | null;
|
|
419
|
+
assertions: ImportAttribute[] | null;
|
|
420
420
|
importKind: "type" | "typeof" | "value" | null;
|
|
421
421
|
module: boolean | null;
|
|
422
422
|
phase: "source" | "defer" | null;
|
package/dist/api.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { a as isFunctionalNode, n as transformJsxMacros, r as restructure, t as getMacroExpression } from "./core-
|
|
2
|
-
|
|
3
|
-
export { getMacroExpression, isFunctionalNode, restructure, transformJsxMacros };
|
|
1
|
+
import { a as isFunctionalNode, n as transformJsxMacros, r as restructure, t as getMacroExpression } from "./core-CspOqTxm.js";
|
|
2
|
+
export { getMacroExpression, isFunctionalNode, restructure, transformJsxMacros };
|
package/dist/astro.cjs
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
Object.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_index = require("./index.cjs");
|
|
6
6
|
//#region src/astro.ts
|
|
7
7
|
var astro_default = (options) => ({
|
|
8
8
|
name: "vue-jsx-vapor",
|
|
9
9
|
hooks: { "astro:config:setup": (astro) => {
|
|
10
10
|
astro.config.vite.plugins ||= [];
|
|
11
|
-
astro.config.vite.plugins.push(
|
|
11
|
+
astro.config.vite.plugins.push(require_index.default.vite(options));
|
|
12
12
|
} }
|
|
13
13
|
});
|
|
14
|
-
|
|
15
14
|
//#endregion
|
|
16
|
-
exports.default = astro_default;
|
|
15
|
+
exports.default = astro_default;
|
package/dist/astro.d.cts
CHANGED
package/dist/astro.d.ts
CHANGED
package/dist/astro.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./raw-BTUP7Cbc.js";
|
|
3
|
-
import { t as src_default } from "./src-BoqluMMt.js";
|
|
4
|
-
|
|
1
|
+
import unplugin from "./index.js";
|
|
5
2
|
//#region src/astro.ts
|
|
6
3
|
var astro_default = (options) => ({
|
|
7
4
|
name: "vue-jsx-vapor",
|
|
8
5
|
hooks: { "astro:config:setup": (astro) => {
|
|
9
6
|
astro.config.vite.plugins ||= [];
|
|
10
|
-
astro.config.vite.plugins.push(
|
|
7
|
+
astro.config.vite.plugins.push(unplugin.vite(options));
|
|
11
8
|
} }
|
|
12
9
|
});
|
|
13
|
-
|
|
14
10
|
//#endregion
|
|
15
|
-
export { astro_default as default };
|
|
11
|
+
export { astro_default as default };
|
package/dist/bun.cjs
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
Object.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
6
5
|
//#region src/bun.ts
|
|
7
|
-
var bun_default =
|
|
8
|
-
|
|
6
|
+
var bun_default = require("./index.cjs").default.bun;
|
|
9
7
|
//#endregion
|
|
10
|
-
exports.default = bun_default;
|
|
8
|
+
exports.default = bun_default;
|
package/dist/bun.d.cts
CHANGED
package/dist/bun.d.ts
CHANGED
package/dist/bun.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./raw-BTUP7Cbc.js";
|
|
3
|
-
import { t as src_default } from "./src-BoqluMMt.js";
|
|
4
|
-
|
|
1
|
+
import unplugin from "./index.js";
|
|
5
2
|
//#region src/bun.ts
|
|
6
|
-
var bun_default =
|
|
7
|
-
|
|
3
|
+
var bun_default = unplugin.bun;
|
|
8
4
|
//#endregion
|
|
9
|
-
export { bun_default as default };
|
|
5
|
+
export { bun_default as default };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import "@babel/parser";
|
|
2
2
|
import MagicString from "magic-string";
|
|
3
3
|
import hash from "hash-sum";
|
|
4
|
-
|
|
5
4
|
//#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
6
5
|
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
7
6
|
function normalizeWindowsPath(input = "") {
|
|
@@ -14,7 +13,6 @@ const extname = function(p) {
|
|
|
14
13
|
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
15
14
|
return match && match[1] || "";
|
|
16
15
|
};
|
|
17
|
-
|
|
18
16
|
//#endregion
|
|
19
17
|
//#region ../../node_modules/.pnpm/ast-kit@2.2.0/node_modules/ast-kit/dist/index.js
|
|
20
18
|
/**
|
|
@@ -442,26 +440,21 @@ function markScopeIdentifier(node, child, knownIds) {
|
|
|
442
440
|
markKnownIds(name, knownIds);
|
|
443
441
|
(node.scopeIds || (node.scopeIds = /* @__PURE__ */ new Set())).add(name);
|
|
444
442
|
}
|
|
445
|
-
|
|
446
443
|
//#endregion
|
|
447
444
|
//#region src/core/helper/use-model.ts?raw
|
|
448
|
-
var use_model_default = "import { customRef, watchSyncEffect } from \"vue\";\nconst EMPTY_OBJ = {};\nexport function useModel(props, name, options =
|
|
449
|
-
|
|
445
|
+
var use_model_default = "import { customRef, watchSyncEffect } from \"vue\";\nconst EMPTY_OBJ = {};\nexport function useModel(props, name, options = EMPTY_OBJ) {\n const res = customRef((track, trigger) => {\n let localValue = options && options.default;\n let prevSetValue = EMPTY_OBJ;\n watchSyncEffect(() => {\n let propValue = props[name];\n if (propValue === void 0) {\n propValue = options && options.default;\n }\n if (!Object.is(localValue, propValue)) {\n localValue = propValue;\n trigger();\n }\n });\n return {\n get() {\n track();\n return options.get ? options.get(localValue) : localValue;\n },\n set(value) {\n const emittedValue = options.set ? options.set(value) : value;\n if (Object.is(emittedValue, localValue) && (prevSetValue === EMPTY_OBJ || Object.is(value, prevSetValue)))\n return;\n localValue = emittedValue;\n trigger();\n for (const emit of [props[`onUpdate:${name}`]].flat()) {\n if (typeof emit === \"function\") emit(emittedValue);\n }\n prevSetValue = value;\n }\n };\n });\n res[Symbol.iterator] = () => {\n let i = 0;\n return {\n next() {\n if (i < 2) {\n return {\n value: i++ ? props[`${name}Modifiers`] || {} : res,\n done: false\n };\n } else {\n return { done: true };\n }\n }\n };\n };\n return res;\n}\n";
|
|
450
446
|
//#endregion
|
|
451
447
|
//#region src/core/helper/use-slots.ts?raw
|
|
452
448
|
var use_slots_default = "import { useSlots as _useSlots } from \"vue\";\nexport function useSlots(defaultSlots = {}) {\n const slots = _useSlots();\n return new Proxy(defaultSlots, {\n get(target, key) {\n return key in slots ? slots[key] : target[key];\n }\n });\n}\n";
|
|
453
|
-
|
|
454
449
|
//#endregion
|
|
455
450
|
//#region src/core/helper/with-defaults.ts?raw
|
|
456
451
|
var with_defaults_default = "function resolveDefaultProps(paths) {\n const result = {};\n for (const path of Object.keys(paths)) {\n const segments = path.split(/[.?[\\]]/).filter(Boolean);\n let current = result;\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i];\n if (i === segments.length - 1) {\n current[segment] = paths[path];\n } else {\n if (!current[segment]) {\n current[segment] = Number.isNaN(Number(segments[i + 1])) ? {} : [];\n }\n current = current[segment];\n }\n }\n }\n return result;\n}\nexport function createPropsDefaultProxy(props, defaults) {\n const defaultProps = resolveDefaultProps(defaults);\n const result = {};\n for (const key of /* @__PURE__ */ new Set([\n ...Object.keys(props),\n ...Object.keys(defaultProps)\n ])) {\n Object.defineProperty(result, key, {\n enumerable: true,\n get: () => props[key] === void 0 ? defaultProps[key] : props[key]\n });\n }\n return result;\n}\n";
|
|
457
|
-
|
|
458
452
|
//#endregion
|
|
459
453
|
//#region src/core/helper/index.ts
|
|
460
454
|
const helperPrefix = "/vue-jsx-vapor/macros";
|
|
461
455
|
const useModelHelperId = `${helperPrefix}/use-model`;
|
|
462
456
|
const withDefaultsHelperId = `${helperPrefix}/with-defaults`;
|
|
463
457
|
const useSlotsHelperId = `${helperPrefix}/use-slots`;
|
|
464
|
-
|
|
465
458
|
//#endregion
|
|
466
459
|
//#region src/core/utils.ts
|
|
467
460
|
function prependFunctionalNode(node, s, result) {
|
|
@@ -495,24 +488,22 @@ function getRequire() {
|
|
|
495
488
|
} catch {}
|
|
496
489
|
}
|
|
497
490
|
const importedMap = /* @__PURE__ */ new WeakMap();
|
|
498
|
-
const HELPER_PREFIX = "__";
|
|
499
491
|
function importHelperFn(s, imported, local = imported, from = "vue") {
|
|
500
492
|
const cacheKey = `${from}@${imported}`;
|
|
501
493
|
if (!importedMap.get(s)?.has(cacheKey)) {
|
|
502
|
-
s.appendLeft(0, `\nimport ${imported === "default" ?
|
|
494
|
+
s.appendLeft(0, `\nimport ${imported === "default" ? "__" + local : `{ ${imported} as ${"__" + local} }`} from ${JSON.stringify(from)};`);
|
|
503
495
|
if (importedMap.has(s)) importedMap.get(s).add(cacheKey);
|
|
504
496
|
else importedMap.set(s, new Set([cacheKey]));
|
|
505
497
|
}
|
|
506
|
-
return
|
|
498
|
+
return `__${local}`;
|
|
507
499
|
}
|
|
508
|
-
|
|
509
500
|
//#endregion
|
|
510
501
|
//#region src/core/restructure.ts
|
|
511
502
|
function restructure(s, node, options = {}) {
|
|
512
503
|
let index = 0;
|
|
513
504
|
const propList = [];
|
|
514
505
|
for (const param of node.params) {
|
|
515
|
-
const path =
|
|
506
|
+
const path = `__props${index++ || ""}`;
|
|
516
507
|
const props = getProps(s, options, param, path);
|
|
517
508
|
if (props) {
|
|
518
509
|
s.overwrite(param.start, param.end, path);
|
|
@@ -578,7 +569,7 @@ function getProps(s, options, node, path = "", props = []) {
|
|
|
578
569
|
});
|
|
579
570
|
}
|
|
580
571
|
propNames.push(`'${prop.key.name}'`);
|
|
581
|
-
} else if (prop?.type === "RestElement" && prop.argument.type === "Identifier" && !prop.argument.name.startsWith(
|
|
572
|
+
} else if (prop?.type === "RestElement" && prop.argument.type === "Identifier" && !prop.argument.name.startsWith(`__props`)) props.push({
|
|
582
573
|
path,
|
|
583
574
|
name: prop.argument.name,
|
|
584
575
|
value: propNames.join(", "),
|
|
@@ -588,7 +579,6 @@ function getProps(s, options, node, path = "", props = []) {
|
|
|
588
579
|
});
|
|
589
580
|
return props.length ? props : void 0;
|
|
590
581
|
}
|
|
591
|
-
|
|
592
582
|
//#endregion
|
|
593
583
|
//#region src/core/define-component/await.ts
|
|
594
584
|
function transformAwait(root, s) {
|
|
@@ -621,7 +611,6 @@ function processAwait(s, node, needSemi, isStatement) {
|
|
|
621
611
|
s.overwrite(node.start, argumentStart, `${needSemi ? `;` : ``}(\n ([__temp,__restore] = ${importHelperFn(s, `withAsyncContext`)}(${containsNestedAwait ? `async ` : ``}() => `);
|
|
622
612
|
s.appendLeft(node.end, `)),\n ${isStatement ? `` : `__temp = `}await __temp,\n __restore()${isStatement ? `` : `,\n __temp`}\n)`);
|
|
623
613
|
}
|
|
624
|
-
|
|
625
614
|
//#endregion
|
|
626
615
|
//#region src/core/define-component/index.ts
|
|
627
616
|
function transformDefineComponent(root, propsName, macros, s) {
|
|
@@ -632,7 +621,7 @@ function transformDefineComponent(root, propsName, macros, s) {
|
|
|
632
621
|
if (root.params[0].type === "Identifier") {
|
|
633
622
|
getWalkedIds(root, propsName).forEach((id) => props[id] = null);
|
|
634
623
|
prependFunctionalNode(root, s, `const ${propsName} = ${importHelperFn(s, "useFullProps", void 0, "/vue-jsx-vapor/props")}()`);
|
|
635
|
-
s.overwrite(root.params[0].start, root.params[0].end, root.params.length > 1 ?
|
|
624
|
+
s.overwrite(root.params[0].start, root.params[0].end, root.params.length > 1 ? `__props` : root.start === root.params[0].start ? "()" : "");
|
|
636
625
|
} else if (root.params[0].type === "ObjectPattern") {
|
|
637
626
|
const restructuredProps = root.params[0];
|
|
638
627
|
for (const prop of restructuredProps.properties) {
|
|
@@ -756,27 +745,23 @@ function getTypeAndValue(s, node) {
|
|
|
756
745
|
skipFactory
|
|
757
746
|
};
|
|
758
747
|
}
|
|
759
|
-
|
|
760
748
|
//#endregion
|
|
761
749
|
//#region src/core/define-expose.ts
|
|
762
750
|
function transformDefineExpose(node, s) {
|
|
763
751
|
s.overwrite(node.callee.start, node.callee.end, ";");
|
|
764
752
|
s.appendRight(node.arguments[0]?.start || node.end - 1, `${importHelperFn(s, "getCurrentInstance", void 0, "/vue-jsx-vapor/props")}().exposed = `);
|
|
765
753
|
}
|
|
766
|
-
|
|
767
754
|
//#endregion
|
|
768
755
|
//#region src/core/define-model.ts
|
|
769
756
|
function transformDefineModel(node, propsName, s) {
|
|
770
757
|
s.overwrite(node.callee.start, node.callee.end, importHelperFn(s, "useModel", void 0, useModelHelperId));
|
|
771
758
|
s.appendRight(node.arguments[0]?.start || node.end - 1, `${propsName}, ${node.arguments[0]?.type === "StringLiteral" ? "" : `'modelValue',`}`);
|
|
772
759
|
}
|
|
773
|
-
|
|
774
760
|
//#endregion
|
|
775
761
|
//#region src/core/define-slots.ts
|
|
776
762
|
function transformDefineSlots(node, s) {
|
|
777
763
|
s.overwrite(node.callee.start, node.callee.end, importHelperFn(s, "useSlots", void 0, useSlotsHelperId));
|
|
778
764
|
}
|
|
779
|
-
|
|
780
765
|
//#endregion
|
|
781
766
|
//#region src/core/define-style.ts
|
|
782
767
|
function transformDefineStyle(defineStyle, index, root, s, importMap, { defineSlots }) {
|
|
@@ -836,7 +821,6 @@ function toCssVarId(name, prefix = "") {
|
|
|
836
821
|
return searchValue === "." ? "-" : name.charCodeAt(replaceValue).toString();
|
|
837
822
|
});
|
|
838
823
|
}
|
|
839
|
-
|
|
840
824
|
//#endregion
|
|
841
825
|
//#region src/core/index.ts
|
|
842
826
|
let babelParse;
|
|
@@ -862,13 +846,13 @@ async function transformJsxMacros(code, id, importMap, options) {
|
|
|
862
846
|
transformDefineStyle(defineStyle, defineStyleIndex++, root, s, importMap, macros);
|
|
863
847
|
});
|
|
864
848
|
if (root === void 0) continue;
|
|
865
|
-
let propsName =
|
|
849
|
+
let propsName = `__props`;
|
|
866
850
|
if (root.params[0]) {
|
|
867
851
|
if (root.params[0].type === "Identifier") propsName = root.params[0].name;
|
|
868
852
|
else if (root.params[0].type === "ObjectPattern") {
|
|
869
853
|
const lastProp = root.params[0].properties.at(-1);
|
|
870
854
|
if (!macros.defineComponent && lastProp?.type === "RestElement" && lastProp.argument.type === "Identifier") propsName = lastProp.argument.name;
|
|
871
|
-
else s.appendRight(root.params[0].extra?.trailingComma ? root.params[0].extra?.trailingComma + 1 : lastProp?.end || root.params[0].end - 1, `${!root.params[0].extra?.trailingComma && root.params[0].properties.length ? "," : ""}
|
|
855
|
+
else s.appendRight(root.params[0].extra?.trailingComma ? root.params[0].extra?.trailingComma + 1 : lastProp?.end || root.params[0].end - 1, `${!root.params[0].extra?.trailingComma && root.params[0].properties.length ? "," : ""} ...__props`);
|
|
872
856
|
}
|
|
873
857
|
} else if (macros.defineModel?.length) s.appendRight(getParamsStart(root, s.original), propsName);
|
|
874
858
|
if (macros.defineComponent) transformDefineComponent(root, propsName, macros, s);
|
|
@@ -945,6 +929,5 @@ function getMacroExpression(node, options) {
|
|
|
945
929
|
].includes(node.callee.name)) return node;
|
|
946
930
|
}
|
|
947
931
|
}
|
|
948
|
-
|
|
949
932
|
//#endregion
|
|
950
|
-
export { isFunctionalNode as a, withDefaultsHelperId as c, use_model_default as d, getRequire as i, with_defaults_default as l, transformJsxMacros as n, useModelHelperId as o, restructure as r, useSlotsHelperId as s, getMacroExpression as t, use_slots_default as u };
|
|
933
|
+
export { isFunctionalNode as a, withDefaultsHelperId as c, use_model_default as d, getRequire as i, with_defaults_default as l, transformJsxMacros as n, useModelHelperId as o, restructure as r, useSlotsHelperId as s, getMacroExpression as t, use_slots_default as u };
|