@unmagic/vms 0.1.3 → 0.1.5

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,3 +1,4 @@
1
+ import pk from "@babel/runtime/package.json" with { type: "json" };
1
2
  import { parse } from "@vue/compiler-sfc";
2
3
  import fs, { createReadStream, existsSync, readFileSync } from "node:fs";
3
4
  import path, { basename, dirname, join, relative, resolve } from "node:path";
@@ -15,7 +16,7 @@ import { fileURLToPath, pathToFileURL } from "node:url";
15
16
  import fs$1 from "fs-extra";
16
17
  import { NodeTypes } from "@vue/compiler-core";
17
18
  import { transformAsync, transformFileAsync, transformFromAstSync } from "@babel/core";
18
- import { createRequire } from "node:module";
19
+ import { replacePlugin } from "rolldown/plugins";
19
20
  import chokidar from "chokidar";
20
21
  import { getPackageInfo } from "local-pkg";
21
22
  import os from "node:os";
@@ -23,7 +24,6 @@ import process$1 from "node:process";
23
24
  import { rolldown } from "rolldown";
24
25
  import { minify } from "terser";
25
26
  import { performance } from "perf_hooks";
26
- //#endregion
27
27
  //#region src/babel.config.ts
28
28
  const config = {
29
29
  targets: {
@@ -70,7 +70,7 @@ const config = {
70
70
  isTSX: true
71
71
  }]],
72
72
  plugins: [
73
- ["@babel/plugin-transform-runtime", { version: "7.29.2" }],
73
+ ["@babel/plugin-transform-runtime", { version: pk.version }],
74
74
  "transform-inline-environment-variables",
75
75
  ["module-resolver", { alias: { "@": "./src" } }],
76
76
  "autocomplete-index"
@@ -1003,12 +1003,13 @@ var ComponentMatcher = class {
1003
1003
  };
1004
1004
  //#endregion
1005
1005
  //#region src/utils/constants.ts
1006
+ const __IS_PROD__ = process.env.NODE_ENV === "production";
1006
1007
  const userConfig = await loadUserConfig();
1007
1008
  if (!userConfig.wx) throw new Error("请在vms.config.*s中配置完整的wx");
1008
1009
  process.env.APP_VERSION = userConfig.wx.version;
1009
1010
  if (!userConfig.sourceDir) userConfig.sourceDir = "src";
1010
1011
  if (!userConfig.outputDir) userConfig.outputDir = "dist";
1011
- const OUTPUT_DIR = path.resolve(userConfig.outputDir, "dev");
1012
+ const OUTPUT_DIR = path.resolve(userConfig.outputDir, __IS_PROD__ ? "prod" : "dev");
1012
1013
  const POLYFILL_OUTPUT_DIR = path.resolve(OUTPUT_DIR, "polyfill");
1013
1014
  const getComponentMatcher = new ComponentMatcher(userConfig.component);
1014
1015
  function findPolyfillDirectory(baseDir) {
@@ -1688,7 +1689,7 @@ function copyProjectConfigFile() {
1688
1689
  return fs$1.readJson(path.join(process.cwd(), "project.config.json")).then((config) => {
1689
1690
  Reflect.deleteProperty(config, "miniprogramRoot");
1690
1691
  Reflect.deleteProperty(config, "srcMiniprogramRoot");
1691
- config.projectName = config.projectName + "-dev";
1692
+ config.projectName = config.projectName + (__IS_PROD__ ? "-prod" : "-dev");
1692
1693
  return fs$1.writeFile(path.join(OUTPUT_DIR, "project.config.json"), JSON.stringify(config, null, 2));
1693
1694
  });
1694
1695
  }
@@ -1739,6 +1740,9 @@ function buildProxyRefsItemAccess(vForInfoList, targetItemIndex, scriptScope, us
1739
1740
  const propsVarName = scriptScope.propsVarName || "__vmsProps";
1740
1741
  expr = t.identifier(propsVarName);
1741
1742
  for (const prop of firstPartProps) expr = t.memberExpression(expr, t.identifier(prop));
1743
+ } else if (firstProp && scriptScope && isImportVariable(firstProp, scriptScope)) {
1744
+ expr = t.identifier(firstProp);
1745
+ for (let i = 1; i < firstPartProps.length; i++) expr = t.memberExpression(expr, t.identifier(firstPartProps[i]));
1742
1746
  } else {
1743
1747
  expr = t.identifier("__vmsProxyRefs");
1744
1748
  for (const prop of firstPartProps) expr = t.memberExpression(expr, t.identifier(prop));
@@ -1784,6 +1788,7 @@ function buildProxyRefsArgument(arg, vForInfoList, vForItemNames, arrowFunctionA
1784
1788
  const propsVarName = scriptScope.propsVarName || "__vmsProps";
1785
1789
  return t.memberExpression(t.identifier(propsVarName), t.identifier(arg.name));
1786
1790
  }
1791
+ if (scriptScope && isImportVariable(arg.name, scriptScope)) return arg;
1787
1792
  return t.memberExpression(t.identifier("__vmsProxyRefs"), t.identifier(arg.name));
1788
1793
  }
1789
1794
  if (t.isOptionalMemberExpression(arg)) {
@@ -2515,7 +2520,7 @@ function processInlineArrowFunction(body, arrowFunctionArguments, counter, callE
2515
2520
  if (usedVars.size > 0 || vForItemUsage?.shouldCreateReference) ctx.needsProxyRefs = true;
2516
2521
  const functionIndex = counter.functionPropertyCounter - 1;
2517
2522
  const dataKey = vForInfoList && vForInfoList.length > 0 ? getFunctionIndexChar(functionIndex) : "";
2518
- const functionBody = createInlineHandlerBody(body, arrowFunctionArguments, usedVars, vForInfoList, vForItemUsage, isAsync, dataKey);
2523
+ const functionBody = createInlineHandlerBody(body, arrowFunctionArguments, usedVars, vForInfoList, vForItemUsage, isAsync, dataKey, ctx.scriptScope);
2519
2524
  const dataArgsAst = vForInfoList && vForInfoList.length > 0 ? vForInfoList.map((info) => {
2520
2525
  const indexName = getVForIndexName(info) || "index";
2521
2526
  return t.identifier(indexName);
@@ -2653,7 +2658,7 @@ function analyzeVForItemUsage(body, vForInfoList, isAsync = false) {
2653
2658
  /**
2654
2659
  * 创建内联处理函数的函数体
2655
2660
  */
2656
- function createInlineHandlerBody(body, arrowFunctionArguments, externalVars, vForInfoList, vForItemUsage, isAsync = false, dataKey = "a") {
2661
+ function createInlineHandlerBody(body, arrowFunctionArguments, externalVars, vForInfoList, vForItemUsage, isAsync = false, dataKey = "a", scriptScope) {
2657
2662
  const statements = [];
2658
2663
  const paramNameMapping = /* @__PURE__ */ new Map();
2659
2664
  if (arrowFunctionArguments.length > 0) {
@@ -2666,9 +2671,9 @@ function createInlineHandlerBody(body, arrowFunctionArguments, externalVars, vFo
2666
2671
  if (vForInfoList && vForInfoList.length > 0) {
2667
2672
  const indexVars = vForInfoList.map((info) => getVForIndexName(info) || "index").map((idx) => t.identifier(idx));
2668
2673
  statements.push(t.variableDeclaration("const", [t.variableDeclarator(t.objectPattern([t.objectProperty(t.identifier(dataKey), t.arrayPattern(indexVars), false, false)]), t.memberExpression(t.memberExpression(t.identifier(EVENT_PARAM_NAME), t.identifier("currentTarget")), t.identifier("dataset")))]));
2669
- if (vForItemUsage?.shouldCreateReference) statements.push(createLocalReference(vForInfoList, vForItemUsage));
2674
+ if (vForItemUsage?.shouldCreateReference) statements.push(createLocalReference(vForInfoList, vForItemUsage, scriptScope));
2670
2675
  }
2671
- const transformedBody = replaceVariableAccess(t.cloneNode(body, true), externalVars, vForInfoList, vForItemUsage, paramNameMapping, isAsync);
2676
+ const transformedBody = replaceVariableAccess(t.cloneNode(body, true), externalVars, vForInfoList, vForItemUsage, paramNameMapping, isAsync, scriptScope);
2672
2677
  statements.push(...transformedBody.body);
2673
2678
  return t.blockStatement(statements);
2674
2679
  }
@@ -2678,15 +2683,15 @@ function createInlineHandlerBody(body, arrowFunctionArguments, externalVars, vFo
2678
2683
  * 因为 createInlineHandlerBody 中外层 item 会被 replaceVariableAccess 替换,
2679
2684
  * 而不会先声明为局部变量
2680
2685
  */
2681
- function createLocalReference(vForInfoList, vForItemUsage) {
2686
+ function createLocalReference(vForInfoList, vForItemUsage, scriptScope) {
2682
2687
  const itemName = vForItemUsage.itemName;
2683
- const accessExpression = buildProxyRefsItemAccess(vForInfoList, vForInfoList.findIndex((info) => getVForItemName(info) === itemName), void 0, true);
2688
+ const accessExpression = buildProxyRefsItemAccess(vForInfoList, vForInfoList.findIndex((info) => getVForItemName(info) === itemName), scriptScope, true);
2684
2689
  return t.variableDeclaration("const", [t.variableDeclarator(t.identifier(itemName), accessExpression)]);
2685
2690
  }
2686
2691
  /**
2687
2692
  * 替换变量访问
2688
2693
  */
2689
- function replaceVariableAccess(body, externalVars, vForInfoList, vForItemUsage, paramNameMapping, isAsync = false) {
2694
+ function replaceVariableAccess(body, externalVars, vForInfoList, vForItemUsage, paramNameMapping, isAsync = false, scriptScope) {
2690
2695
  const localVars = /* @__PURE__ */ new Set();
2691
2696
  const ast = reparseBodyAsAST(body, isAsync);
2692
2697
  traverse(ast, { ...createLocalVarCollector(localVars) });
@@ -2715,7 +2720,7 @@ function replaceVariableAccess(body, externalVars, vForInfoList, vForItemUsage,
2715
2720
  }
2716
2721
  if (isVForItem) if (itemIndex === vForInfoList.length - 1 && vForItemUsage?.shouldCreateReference) return;
2717
2722
  else {
2718
- const accessExpression = buildProxyRefsItemAccess(vForInfoList, itemIndex);
2723
+ const accessExpression = buildProxyRefsItemAccess(vForInfoList, itemIndex, scriptScope);
2719
2724
  path.replaceWith(accessExpression);
2720
2725
  return;
2721
2726
  }
@@ -3460,687 +3465,6 @@ async function writeFileIfChangedAsync(filePath, newContent) {
3460
3465
  }
3461
3466
  }
3462
3467
  //#endregion
3463
- //#region node_modules/.pnpm/rolldown@1.0.0/node_modules/rolldown/dist/shared/binding-ESkOU1xr.mjs
3464
- var __create = Object.create;
3465
- var __defProp = Object.defineProperty;
3466
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3467
- var __getOwnPropNames = Object.getOwnPropertyNames;
3468
- var __getProtoOf = Object.getPrototypeOf;
3469
- var __hasOwnProp = Object.prototype.hasOwnProperty;
3470
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
3471
- var __copyProps = (to, from, except, desc) => {
3472
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
3473
- key = keys[i];
3474
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
3475
- get: ((k) => from[k]).bind(null, key),
3476
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
3477
- });
3478
- }
3479
- return to;
3480
- };
3481
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
3482
- value: mod,
3483
- enumerable: true
3484
- }) : target, mod));
3485
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
3486
- var require_webcontainer_fallback = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3487
- const fs = __require("node:fs");
3488
- const childProcess = __require("node:child_process");
3489
- const version = JSON.parse(fs.readFileSync(__require.resolve("rolldown/package.json"), "utf-8")).version;
3490
- const baseDir = `/tmp/rolldown-${version}`;
3491
- const bindingEntry = `${baseDir}/node_modules/@rolldown/binding-wasm32-wasi/rolldown-binding.wasi.cjs`;
3492
- if (!fs.existsSync(bindingEntry)) {
3493
- const bindingPkg = `@rolldown/binding-wasm32-wasi@${version}`;
3494
- fs.rmSync(baseDir, {
3495
- recursive: true,
3496
- force: true
3497
- });
3498
- fs.mkdirSync(baseDir, { recursive: true });
3499
- console.log(`[rolldown] Downloading ${bindingPkg} on WebContainer...`);
3500
- childProcess.execFileSync("pnpm", ["i", bindingPkg], {
3501
- cwd: baseDir,
3502
- stdio: "inherit"
3503
- });
3504
- }
3505
- module.exports = __require(bindingEntry);
3506
- }));
3507
- var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3508
- const { readFileSync } = __require("node:fs");
3509
- let nativeBinding = null;
3510
- const loadErrors = [];
3511
- const isMusl = () => {
3512
- let musl = false;
3513
- if (process.platform === "linux") {
3514
- musl = isMuslFromFilesystem();
3515
- if (musl === null) musl = isMuslFromReport();
3516
- if (musl === null) musl = isMuslFromChildProcess();
3517
- }
3518
- return musl;
3519
- };
3520
- const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
3521
- const isMuslFromFilesystem = () => {
3522
- try {
3523
- return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
3524
- } catch {
3525
- return null;
3526
- }
3527
- };
3528
- const isMuslFromReport = () => {
3529
- let report = null;
3530
- if (typeof process.report?.getReport === "function") {
3531
- process.report.excludeNetwork = true;
3532
- report = process.report.getReport();
3533
- }
3534
- if (!report) return null;
3535
- if (report.header && report.header.glibcVersionRuntime) return false;
3536
- if (Array.isArray(report.sharedObjects)) {
3537
- if (report.sharedObjects.some(isFileMusl)) return true;
3538
- }
3539
- return false;
3540
- };
3541
- const isMuslFromChildProcess = () => {
3542
- try {
3543
- return __require("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
3544
- } catch (e) {
3545
- return false;
3546
- }
3547
- };
3548
- function requireNative() {
3549
- if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) try {
3550
- return __require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
3551
- } catch (err) {
3552
- loadErrors.push(err);
3553
- }
3554
- else if (process.platform === "android") if (process.arch === "arm64") {
3555
- try {
3556
- return __require("./rolldown-binding.android-arm64.node");
3557
- } catch (e) {
3558
- loadErrors.push(e);
3559
- }
3560
- try {
3561
- const binding = __require("@rolldown/binding-android-arm64");
3562
- const bindingPackageVersion = __require("@rolldown/binding-android-arm64/package.json").version;
3563
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3564
- return binding;
3565
- } catch (e) {
3566
- loadErrors.push(e);
3567
- }
3568
- } else if (process.arch === "arm") {
3569
- try {
3570
- return __require("./rolldown-binding.android-arm-eabi.node");
3571
- } catch (e) {
3572
- loadErrors.push(e);
3573
- }
3574
- try {
3575
- const binding = __require("@rolldown/binding-android-arm-eabi");
3576
- const bindingPackageVersion = __require("@rolldown/binding-android-arm-eabi/package.json").version;
3577
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3578
- return binding;
3579
- } catch (e) {
3580
- loadErrors.push(e);
3581
- }
3582
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Android ${process.arch}`));
3583
- else if (process.platform === "win32") if (process.arch === "x64") if (process.config?.variables?.shlib_suffix === "dll.a" || process.config?.variables?.node_target_type === "shared_library") {
3584
- try {
3585
- return __require("./rolldown-binding.win32-x64-gnu.node");
3586
- } catch (e) {
3587
- loadErrors.push(e);
3588
- }
3589
- try {
3590
- const binding = __require("@rolldown/binding-win32-x64-gnu");
3591
- const bindingPackageVersion = __require("@rolldown/binding-win32-x64-gnu/package.json").version;
3592
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3593
- return binding;
3594
- } catch (e) {
3595
- loadErrors.push(e);
3596
- }
3597
- } else {
3598
- try {
3599
- return __require("./rolldown-binding.win32-x64-msvc.node");
3600
- } catch (e) {
3601
- loadErrors.push(e);
3602
- }
3603
- try {
3604
- const binding = __require("@rolldown/binding-win32-x64-msvc");
3605
- const bindingPackageVersion = __require("@rolldown/binding-win32-x64-msvc/package.json").version;
3606
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3607
- return binding;
3608
- } catch (e) {
3609
- loadErrors.push(e);
3610
- }
3611
- }
3612
- else if (process.arch === "ia32") {
3613
- try {
3614
- return __require("./rolldown-binding.win32-ia32-msvc.node");
3615
- } catch (e) {
3616
- loadErrors.push(e);
3617
- }
3618
- try {
3619
- const binding = __require("@rolldown/binding-win32-ia32-msvc");
3620
- const bindingPackageVersion = __require("@rolldown/binding-win32-ia32-msvc/package.json").version;
3621
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3622
- return binding;
3623
- } catch (e) {
3624
- loadErrors.push(e);
3625
- }
3626
- } else if (process.arch === "arm64") {
3627
- try {
3628
- return __require("./rolldown-binding.win32-arm64-msvc.node");
3629
- } catch (e) {
3630
- loadErrors.push(e);
3631
- }
3632
- try {
3633
- const binding = __require("@rolldown/binding-win32-arm64-msvc");
3634
- const bindingPackageVersion = __require("@rolldown/binding-win32-arm64-msvc/package.json").version;
3635
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3636
- return binding;
3637
- } catch (e) {
3638
- loadErrors.push(e);
3639
- }
3640
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Windows: ${process.arch}`));
3641
- else if (process.platform === "darwin") {
3642
- try {
3643
- return __require("./rolldown-binding.darwin-universal.node");
3644
- } catch (e) {
3645
- loadErrors.push(e);
3646
- }
3647
- try {
3648
- const binding = __require("@rolldown/binding-darwin-universal");
3649
- const bindingPackageVersion = __require("@rolldown/binding-darwin-universal/package.json").version;
3650
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3651
- return binding;
3652
- } catch (e) {
3653
- loadErrors.push(e);
3654
- }
3655
- if (process.arch === "x64") {
3656
- try {
3657
- return __require("./rolldown-binding.darwin-x64.node");
3658
- } catch (e) {
3659
- loadErrors.push(e);
3660
- }
3661
- try {
3662
- const binding = __require("@rolldown/binding-darwin-x64");
3663
- const bindingPackageVersion = __require("@rolldown/binding-darwin-x64/package.json").version;
3664
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3665
- return binding;
3666
- } catch (e) {
3667
- loadErrors.push(e);
3668
- }
3669
- } else if (process.arch === "arm64") {
3670
- try {
3671
- return __require("./rolldown-binding.darwin-arm64.node");
3672
- } catch (e) {
3673
- loadErrors.push(e);
3674
- }
3675
- try {
3676
- const binding = __require("@rolldown/binding-darwin-arm64");
3677
- const bindingPackageVersion = __require("@rolldown/binding-darwin-arm64/package.json").version;
3678
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3679
- return binding;
3680
- } catch (e) {
3681
- loadErrors.push(e);
3682
- }
3683
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on macOS: ${process.arch}`));
3684
- } else if (process.platform === "freebsd") if (process.arch === "x64") {
3685
- try {
3686
- return __require("./rolldown-binding.freebsd-x64.node");
3687
- } catch (e) {
3688
- loadErrors.push(e);
3689
- }
3690
- try {
3691
- const binding = __require("@rolldown/binding-freebsd-x64");
3692
- const bindingPackageVersion = __require("@rolldown/binding-freebsd-x64/package.json").version;
3693
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3694
- return binding;
3695
- } catch (e) {
3696
- loadErrors.push(e);
3697
- }
3698
- } else if (process.arch === "arm64") {
3699
- try {
3700
- return __require("./rolldown-binding.freebsd-arm64.node");
3701
- } catch (e) {
3702
- loadErrors.push(e);
3703
- }
3704
- try {
3705
- const binding = __require("@rolldown/binding-freebsd-arm64");
3706
- const bindingPackageVersion = __require("@rolldown/binding-freebsd-arm64/package.json").version;
3707
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3708
- return binding;
3709
- } catch (e) {
3710
- loadErrors.push(e);
3711
- }
3712
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
3713
- else if (process.platform === "linux") if (process.arch === "x64") if (isMusl()) {
3714
- try {
3715
- return __require("./rolldown-binding.linux-x64-musl.node");
3716
- } catch (e) {
3717
- loadErrors.push(e);
3718
- }
3719
- try {
3720
- const binding = __require("@rolldown/binding-linux-x64-musl");
3721
- const bindingPackageVersion = __require("@rolldown/binding-linux-x64-musl/package.json").version;
3722
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3723
- return binding;
3724
- } catch (e) {
3725
- loadErrors.push(e);
3726
- }
3727
- } else {
3728
- try {
3729
- return __require("../rolldown-binding.linux-x64-gnu.node");
3730
- } catch (e) {
3731
- loadErrors.push(e);
3732
- }
3733
- try {
3734
- const binding = __require("@rolldown/binding-linux-x64-gnu");
3735
- const bindingPackageVersion = __require("@rolldown/binding-linux-x64-gnu/package.json").version;
3736
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3737
- return binding;
3738
- } catch (e) {
3739
- loadErrors.push(e);
3740
- }
3741
- }
3742
- else if (process.arch === "arm64") if (isMusl()) {
3743
- try {
3744
- return __require("./rolldown-binding.linux-arm64-musl.node");
3745
- } catch (e) {
3746
- loadErrors.push(e);
3747
- }
3748
- try {
3749
- const binding = __require("@rolldown/binding-linux-arm64-musl");
3750
- const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-musl/package.json").version;
3751
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3752
- return binding;
3753
- } catch (e) {
3754
- loadErrors.push(e);
3755
- }
3756
- } else {
3757
- try {
3758
- return __require("./rolldown-binding.linux-arm64-gnu.node");
3759
- } catch (e) {
3760
- loadErrors.push(e);
3761
- }
3762
- try {
3763
- const binding = __require("@rolldown/binding-linux-arm64-gnu");
3764
- const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-gnu/package.json").version;
3765
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3766
- return binding;
3767
- } catch (e) {
3768
- loadErrors.push(e);
3769
- }
3770
- }
3771
- else if (process.arch === "arm") if (isMusl()) {
3772
- try {
3773
- return __require("./rolldown-binding.linux-arm-musleabihf.node");
3774
- } catch (e) {
3775
- loadErrors.push(e);
3776
- }
3777
- try {
3778
- const binding = __require("@rolldown/binding-linux-arm-musleabihf");
3779
- const bindingPackageVersion = __require("@rolldown/binding-linux-arm-musleabihf/package.json").version;
3780
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3781
- return binding;
3782
- } catch (e) {
3783
- loadErrors.push(e);
3784
- }
3785
- } else {
3786
- try {
3787
- return __require("./rolldown-binding.linux-arm-gnueabihf.node");
3788
- } catch (e) {
3789
- loadErrors.push(e);
3790
- }
3791
- try {
3792
- const binding = __require("@rolldown/binding-linux-arm-gnueabihf");
3793
- const bindingPackageVersion = __require("@rolldown/binding-linux-arm-gnueabihf/package.json").version;
3794
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3795
- return binding;
3796
- } catch (e) {
3797
- loadErrors.push(e);
3798
- }
3799
- }
3800
- else if (process.arch === "loong64") if (isMusl()) {
3801
- try {
3802
- return __require("./rolldown-binding.linux-loong64-musl.node");
3803
- } catch (e) {
3804
- loadErrors.push(e);
3805
- }
3806
- try {
3807
- const binding = __require("@rolldown/binding-linux-loong64-musl");
3808
- const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-musl/package.json").version;
3809
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3810
- return binding;
3811
- } catch (e) {
3812
- loadErrors.push(e);
3813
- }
3814
- } else {
3815
- try {
3816
- return __require("./rolldown-binding.linux-loong64-gnu.node");
3817
- } catch (e) {
3818
- loadErrors.push(e);
3819
- }
3820
- try {
3821
- const binding = __require("@rolldown/binding-linux-loong64-gnu");
3822
- const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-gnu/package.json").version;
3823
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3824
- return binding;
3825
- } catch (e) {
3826
- loadErrors.push(e);
3827
- }
3828
- }
3829
- else if (process.arch === "riscv64") if (isMusl()) {
3830
- try {
3831
- return __require("./rolldown-binding.linux-riscv64-musl.node");
3832
- } catch (e) {
3833
- loadErrors.push(e);
3834
- }
3835
- try {
3836
- const binding = __require("@rolldown/binding-linux-riscv64-musl");
3837
- const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-musl/package.json").version;
3838
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3839
- return binding;
3840
- } catch (e) {
3841
- loadErrors.push(e);
3842
- }
3843
- } else {
3844
- try {
3845
- return __require("./rolldown-binding.linux-riscv64-gnu.node");
3846
- } catch (e) {
3847
- loadErrors.push(e);
3848
- }
3849
- try {
3850
- const binding = __require("@rolldown/binding-linux-riscv64-gnu");
3851
- const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-gnu/package.json").version;
3852
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3853
- return binding;
3854
- } catch (e) {
3855
- loadErrors.push(e);
3856
- }
3857
- }
3858
- else if (process.arch === "ppc64") {
3859
- try {
3860
- return __require("./rolldown-binding.linux-ppc64-gnu.node");
3861
- } catch (e) {
3862
- loadErrors.push(e);
3863
- }
3864
- try {
3865
- const binding = __require("@rolldown/binding-linux-ppc64-gnu");
3866
- const bindingPackageVersion = __require("@rolldown/binding-linux-ppc64-gnu/package.json").version;
3867
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3868
- return binding;
3869
- } catch (e) {
3870
- loadErrors.push(e);
3871
- }
3872
- } else if (process.arch === "s390x") {
3873
- try {
3874
- return __require("./rolldown-binding.linux-s390x-gnu.node");
3875
- } catch (e) {
3876
- loadErrors.push(e);
3877
- }
3878
- try {
3879
- const binding = __require("@rolldown/binding-linux-s390x-gnu");
3880
- const bindingPackageVersion = __require("@rolldown/binding-linux-s390x-gnu/package.json").version;
3881
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3882
- return binding;
3883
- } catch (e) {
3884
- loadErrors.push(e);
3885
- }
3886
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Linux: ${process.arch}`));
3887
- else if (process.platform === "openharmony") if (process.arch === "arm64") {
3888
- try {
3889
- return __require("./rolldown-binding.openharmony-arm64.node");
3890
- } catch (e) {
3891
- loadErrors.push(e);
3892
- }
3893
- try {
3894
- const binding = __require("@rolldown/binding-openharmony-arm64");
3895
- const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm64/package.json").version;
3896
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3897
- return binding;
3898
- } catch (e) {
3899
- loadErrors.push(e);
3900
- }
3901
- } else if (process.arch === "x64") {
3902
- try {
3903
- return __require("./rolldown-binding.openharmony-x64.node");
3904
- } catch (e) {
3905
- loadErrors.push(e);
3906
- }
3907
- try {
3908
- const binding = __require("@rolldown/binding-openharmony-x64");
3909
- const bindingPackageVersion = __require("@rolldown/binding-openharmony-x64/package.json").version;
3910
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3911
- return binding;
3912
- } catch (e) {
3913
- loadErrors.push(e);
3914
- }
3915
- } else if (process.arch === "arm") {
3916
- try {
3917
- return __require("./rolldown-binding.openharmony-arm.node");
3918
- } catch (e) {
3919
- loadErrors.push(e);
3920
- }
3921
- try {
3922
- const binding = __require("@rolldown/binding-openharmony-arm");
3923
- const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm/package.json").version;
3924
- if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3925
- return binding;
3926
- } catch (e) {
3927
- loadErrors.push(e);
3928
- }
3929
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
3930
- else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
3931
- }
3932
- nativeBinding = requireNative();
3933
- if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
3934
- let wasiBinding = null;
3935
- let wasiBindingError = null;
3936
- try {
3937
- wasiBinding = __require("../rolldown-binding.wasi.cjs");
3938
- nativeBinding = wasiBinding;
3939
- } catch (err) {
3940
- if (process.env.NAPI_RS_FORCE_WASI) wasiBindingError = err;
3941
- }
3942
- if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) try {
3943
- wasiBinding = __require("@rolldown/binding-wasm32-wasi");
3944
- nativeBinding = wasiBinding;
3945
- } catch (err) {
3946
- if (process.env.NAPI_RS_FORCE_WASI) {
3947
- if (!wasiBindingError) wasiBindingError = err;
3948
- else wasiBindingError.cause = err;
3949
- loadErrors.push(err);
3950
- }
3951
- }
3952
- if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
3953
- const error = /* @__PURE__ */ new Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
3954
- error.cause = wasiBindingError;
3955
- throw error;
3956
- }
3957
- }
3958
- if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) try {
3959
- nativeBinding = require_webcontainer_fallback();
3960
- } catch (err) {
3961
- loadErrors.push(err);
3962
- }
3963
- if (!nativeBinding) {
3964
- if (loadErrors.length > 0) throw new Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.", { cause: loadErrors.reduce((err, cur) => {
3965
- cur.cause = err;
3966
- return cur;
3967
- }) });
3968
- throw new Error(`Failed to load native binding`);
3969
- }
3970
- module.exports = nativeBinding;
3971
- module.exports.minify = nativeBinding.minify;
3972
- module.exports.minifySync = nativeBinding.minifySync;
3973
- module.exports.Severity = nativeBinding.Severity;
3974
- module.exports.ParseResult = nativeBinding.ParseResult;
3975
- module.exports.ExportExportNameKind = nativeBinding.ExportExportNameKind;
3976
- module.exports.ExportImportNameKind = nativeBinding.ExportImportNameKind;
3977
- module.exports.ExportLocalNameKind = nativeBinding.ExportLocalNameKind;
3978
- module.exports.ImportNameKind = nativeBinding.ImportNameKind;
3979
- module.exports.parse = nativeBinding.parse;
3980
- module.exports.parseSync = nativeBinding.parseSync;
3981
- module.exports.rawTransferSupported = nativeBinding.rawTransferSupported;
3982
- module.exports.ResolverFactory = nativeBinding.ResolverFactory;
3983
- module.exports.EnforceExtension = nativeBinding.EnforceExtension;
3984
- module.exports.ModuleType = nativeBinding.ModuleType;
3985
- module.exports.sync = nativeBinding.sync;
3986
- module.exports.HelperMode = nativeBinding.HelperMode;
3987
- module.exports.isolatedDeclaration = nativeBinding.isolatedDeclaration;
3988
- module.exports.isolatedDeclarationSync = nativeBinding.isolatedDeclarationSync;
3989
- module.exports.moduleRunnerTransform = nativeBinding.moduleRunnerTransform;
3990
- module.exports.moduleRunnerTransformSync = nativeBinding.moduleRunnerTransformSync;
3991
- module.exports.transform = nativeBinding.transform;
3992
- module.exports.transformSync = nativeBinding.transformSync;
3993
- module.exports.BindingBundleEndEventData = nativeBinding.BindingBundleEndEventData;
3994
- module.exports.BindingBundleErrorEventData = nativeBinding.BindingBundleErrorEventData;
3995
- module.exports.BindingBundler = nativeBinding.BindingBundler;
3996
- module.exports.BindingCallableBuiltinPlugin = nativeBinding.BindingCallableBuiltinPlugin;
3997
- module.exports.BindingChunkingContext = nativeBinding.BindingChunkingContext;
3998
- module.exports.BindingDecodedMap = nativeBinding.BindingDecodedMap;
3999
- module.exports.BindingDevEngine = nativeBinding.BindingDevEngine;
4000
- module.exports.BindingLoadPluginContext = nativeBinding.BindingLoadPluginContext;
4001
- module.exports.BindingMagicString = nativeBinding.BindingMagicString;
4002
- module.exports.BindingModuleInfo = nativeBinding.BindingModuleInfo;
4003
- module.exports.BindingNormalizedOptions = nativeBinding.BindingNormalizedOptions;
4004
- module.exports.BindingOutputAsset = nativeBinding.BindingOutputAsset;
4005
- module.exports.BindingOutputChunk = nativeBinding.BindingOutputChunk;
4006
- module.exports.BindingPluginContext = nativeBinding.BindingPluginContext;
4007
- module.exports.BindingRenderedChunk = nativeBinding.BindingRenderedChunk;
4008
- module.exports.BindingRenderedChunkMeta = nativeBinding.BindingRenderedChunkMeta;
4009
- module.exports.BindingRenderedModule = nativeBinding.BindingRenderedModule;
4010
- module.exports.BindingSourceMap = nativeBinding.BindingSourceMap;
4011
- module.exports.BindingTransformPluginContext = nativeBinding.BindingTransformPluginContext;
4012
- module.exports.BindingWatcher = nativeBinding.BindingWatcher;
4013
- module.exports.BindingWatcherBundler = nativeBinding.BindingWatcherBundler;
4014
- module.exports.BindingWatcherChangeData = nativeBinding.BindingWatcherChangeData;
4015
- module.exports.BindingWatcherEvent = nativeBinding.BindingWatcherEvent;
4016
- module.exports.ParallelJsPluginRegistry = nativeBinding.ParallelJsPluginRegistry;
4017
- module.exports.ScheduledBuild = nativeBinding.ScheduledBuild;
4018
- module.exports.TraceSubscriberGuard = nativeBinding.TraceSubscriberGuard;
4019
- module.exports.TsconfigCache = nativeBinding.TsconfigCache;
4020
- module.exports.BindingAttachDebugInfo = nativeBinding.BindingAttachDebugInfo;
4021
- module.exports.BindingBuiltinPluginName = nativeBinding.BindingBuiltinPluginName;
4022
- module.exports.BindingChunkModuleOrderBy = nativeBinding.BindingChunkModuleOrderBy;
4023
- module.exports.BindingLogLevel = nativeBinding.BindingLogLevel;
4024
- module.exports.BindingPluginOrder = nativeBinding.BindingPluginOrder;
4025
- module.exports.BindingPropertyReadSideEffects = nativeBinding.BindingPropertyReadSideEffects;
4026
- module.exports.BindingPropertyWriteSideEffects = nativeBinding.BindingPropertyWriteSideEffects;
4027
- module.exports.BindingRebuildStrategy = nativeBinding.BindingRebuildStrategy;
4028
- module.exports.collapseSourcemaps = nativeBinding.collapseSourcemaps;
4029
- module.exports.enhancedTransform = nativeBinding.enhancedTransform;
4030
- module.exports.enhancedTransformSync = nativeBinding.enhancedTransformSync;
4031
- module.exports.FilterTokenKind = nativeBinding.FilterTokenKind;
4032
- module.exports.initTraceSubscriber = nativeBinding.initTraceSubscriber;
4033
- module.exports.registerPlugins = nativeBinding.registerPlugins;
4034
- module.exports.resolveTsconfig = nativeBinding.resolveTsconfig;
4035
- module.exports.shutdownAsyncRuntime = nativeBinding.shutdownAsyncRuntime;
4036
- module.exports.startAsyncRuntime = nativeBinding.startAsyncRuntime;
4037
- }));
4038
- //#endregion
4039
- //#region node_modules/.pnpm/rolldown@1.0.0/node_modules/rolldown/dist/shared/logs-D80CXhvg.mjs
4040
- const PLUGIN_ERROR = "PLUGIN_ERROR";
4041
- function logPluginError(error, plugin, { hook, id } = {}) {
4042
- try {
4043
- const code = error.code;
4044
- if (!error.pluginCode && code != null && (typeof code !== "string" || !code.startsWith("PLUGIN_"))) error.pluginCode = code;
4045
- error.code = PLUGIN_ERROR;
4046
- error.plugin = plugin;
4047
- if (hook) error.hook = hook;
4048
- if (id) error.id = id;
4049
- } catch (_) {} finally {
4050
- return error;
4051
- }
4052
- }
4053
- function error(base) {
4054
- if (!(base instanceof Error)) {
4055
- base = Object.assign(new Error(base.message), base);
4056
- Object.defineProperty(base, "name", {
4057
- value: "RolldownError",
4058
- writable: true
4059
- });
4060
- }
4061
- throw base;
4062
- }
4063
- //#endregion
4064
- //#region node_modules/.pnpm/rolldown@1.0.0/node_modules/rolldown/dist/shared/normalize-string-or-regex-dAjLOSbp.mjs
4065
- var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
4066
- var BuiltinPlugin = class {
4067
- name;
4068
- _options;
4069
- /** Vite-specific option to control plugin ordering */
4070
- enforce;
4071
- constructor(name, _options) {
4072
- this.name = name;
4073
- this._options = _options;
4074
- }
4075
- };
4076
- function makeBuiltinPluginCallable(plugin) {
4077
- let callablePlugin = new import_binding.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
4078
- const wrappedPlugin = plugin;
4079
- for (const key in callablePlugin) {
4080
- const wrappedHook = async function(...args) {
4081
- try {
4082
- return await callablePlugin[key](...args);
4083
- } catch (e) {
4084
- if (e instanceof Error && !e.stack?.includes("at ")) Error.captureStackTrace(e, wrappedPlugin[key]);
4085
- return error(logPluginError(e, plugin.name, {
4086
- hook: key,
4087
- id: key === "transform" ? args[2] : void 0
4088
- }));
4089
- }
4090
- };
4091
- const order = callablePlugin.getOrder(key);
4092
- if (order == void 0) wrappedPlugin[key] = wrappedHook;
4093
- else wrappedPlugin[key] = {
4094
- handler: wrappedHook,
4095
- order
4096
- };
4097
- }
4098
- return wrappedPlugin;
4099
- }
4100
- function bindingifyBuiltInPlugin(plugin) {
4101
- return {
4102
- __name: plugin.name,
4103
- options: plugin._options
4104
- };
4105
- }
4106
- //#endregion
4107
- //#region node_modules/.pnpm/rolldown@1.0.0/node_modules/rolldown/dist/plugins-index.mjs
4108
- /**
4109
- * Replaces targeted strings in files while bundling.
4110
- *
4111
- * @example
4112
- * **Basic usage**
4113
- * ```js
4114
- * replacePlugin({
4115
- * 'process.env.NODE_ENV': JSON.stringify('production'),
4116
- * __buildVersion: 15
4117
- * })
4118
- * ```
4119
- * @example
4120
- * **With options**
4121
- * ```js
4122
- * replacePlugin({
4123
- * 'process.env.NODE_ENV': JSON.stringify('production'),
4124
- * __buildVersion: 15
4125
- * }, {
4126
- * preventAssignment: false,
4127
- * })
4128
- * ```
4129
- *
4130
- * @see https://rolldown.rs/builtin-plugins/replace
4131
- * @category Builtin Plugins
4132
- */
4133
- function replacePlugin(values = {}, options = {}) {
4134
- Object.keys(values).forEach((key) => {
4135
- const value = values[key];
4136
- if (typeof value !== "string") values[key] = String(value);
4137
- });
4138
- return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:replace", {
4139
- ...options,
4140
- values
4141
- }));
4142
- }
4143
- //#endregion
4144
3468
  //#region src/cli.ts
4145
3469
  const NODE_ENV = process$1.env.NODE_ENV || "production";
4146
3470
  let pagePaths = null;
package/dist/index.js CHANGED
@@ -2,7 +2,8 @@ import dotenv from "dotenv-flow";
2
2
  //#region src/index.ts
3
3
  async function runVMS(options) {
4
4
  dotenv.config({ node_env: options.mode });
5
- const { dev, prod } = await import("./cli-B8qDheMe.js");
5
+ process.env.NODE_ENV = options.mode;
6
+ const { dev, prod } = await import("./cli-C4WEuskd.js");
6
7
  if (options.mode === "production") return prod(options);
7
8
  else return dev();
8
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unmagic/vms",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "基于 @unmagic/vue-mini 的Vue3 单文件组件构建工具",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",