@unmagic/vms 0.1.4 → 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
  }
@@ -3464,687 +3465,6 @@ async function writeFileIfChangedAsync(filePath, newContent) {
3464
3465
  }
3465
3466
  }
3466
3467
  //#endregion
3467
- //#region node_modules/.pnpm/rolldown@1.0.0/node_modules/rolldown/dist/shared/binding-ESkOU1xr.mjs
3468
- var __create = Object.create;
3469
- var __defProp = Object.defineProperty;
3470
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3471
- var __getOwnPropNames = Object.getOwnPropertyNames;
3472
- var __getProtoOf = Object.getPrototypeOf;
3473
- var __hasOwnProp = Object.prototype.hasOwnProperty;
3474
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
3475
- var __copyProps = (to, from, except, desc) => {
3476
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
3477
- key = keys[i];
3478
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
3479
- get: ((k) => from[k]).bind(null, key),
3480
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
3481
- });
3482
- }
3483
- return to;
3484
- };
3485
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
3486
- value: mod,
3487
- enumerable: true
3488
- }) : target, mod));
3489
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
3490
- var require_webcontainer_fallback = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3491
- const fs = __require("node:fs");
3492
- const childProcess = __require("node:child_process");
3493
- const version = JSON.parse(fs.readFileSync(__require.resolve("rolldown/package.json"), "utf-8")).version;
3494
- const baseDir = `/tmp/rolldown-${version}`;
3495
- const bindingEntry = `${baseDir}/node_modules/@rolldown/binding-wasm32-wasi/rolldown-binding.wasi.cjs`;
3496
- if (!fs.existsSync(bindingEntry)) {
3497
- const bindingPkg = `@rolldown/binding-wasm32-wasi@${version}`;
3498
- fs.rmSync(baseDir, {
3499
- recursive: true,
3500
- force: true
3501
- });
3502
- fs.mkdirSync(baseDir, { recursive: true });
3503
- console.log(`[rolldown] Downloading ${bindingPkg} on WebContainer...`);
3504
- childProcess.execFileSync("pnpm", ["i", bindingPkg], {
3505
- cwd: baseDir,
3506
- stdio: "inherit"
3507
- });
3508
- }
3509
- module.exports = __require(bindingEntry);
3510
- }));
3511
- var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3512
- const { readFileSync } = __require("node:fs");
3513
- let nativeBinding = null;
3514
- const loadErrors = [];
3515
- const isMusl = () => {
3516
- let musl = false;
3517
- if (process.platform === "linux") {
3518
- musl = isMuslFromFilesystem();
3519
- if (musl === null) musl = isMuslFromReport();
3520
- if (musl === null) musl = isMuslFromChildProcess();
3521
- }
3522
- return musl;
3523
- };
3524
- const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
3525
- const isMuslFromFilesystem = () => {
3526
- try {
3527
- return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
3528
- } catch {
3529
- return null;
3530
- }
3531
- };
3532
- const isMuslFromReport = () => {
3533
- let report = null;
3534
- if (typeof process.report?.getReport === "function") {
3535
- process.report.excludeNetwork = true;
3536
- report = process.report.getReport();
3537
- }
3538
- if (!report) return null;
3539
- if (report.header && report.header.glibcVersionRuntime) return false;
3540
- if (Array.isArray(report.sharedObjects)) {
3541
- if (report.sharedObjects.some(isFileMusl)) return true;
3542
- }
3543
- return false;
3544
- };
3545
- const isMuslFromChildProcess = () => {
3546
- try {
3547
- return __require("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
3548
- } catch (e) {
3549
- return false;
3550
- }
3551
- };
3552
- function requireNative() {
3553
- if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) try {
3554
- return __require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
3555
- } catch (err) {
3556
- loadErrors.push(err);
3557
- }
3558
- else if (process.platform === "android") if (process.arch === "arm64") {
3559
- try {
3560
- return __require("./rolldown-binding.android-arm64.node");
3561
- } catch (e) {
3562
- loadErrors.push(e);
3563
- }
3564
- try {
3565
- const binding = __require("@rolldown/binding-android-arm64");
3566
- const bindingPackageVersion = __require("@rolldown/binding-android-arm64/package.json").version;
3567
- 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.`);
3568
- return binding;
3569
- } catch (e) {
3570
- loadErrors.push(e);
3571
- }
3572
- } else if (process.arch === "arm") {
3573
- try {
3574
- return __require("./rolldown-binding.android-arm-eabi.node");
3575
- } catch (e) {
3576
- loadErrors.push(e);
3577
- }
3578
- try {
3579
- const binding = __require("@rolldown/binding-android-arm-eabi");
3580
- const bindingPackageVersion = __require("@rolldown/binding-android-arm-eabi/package.json").version;
3581
- 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.`);
3582
- return binding;
3583
- } catch (e) {
3584
- loadErrors.push(e);
3585
- }
3586
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Android ${process.arch}`));
3587
- 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") {
3588
- try {
3589
- return __require("./rolldown-binding.win32-x64-gnu.node");
3590
- } catch (e) {
3591
- loadErrors.push(e);
3592
- }
3593
- try {
3594
- const binding = __require("@rolldown/binding-win32-x64-gnu");
3595
- const bindingPackageVersion = __require("@rolldown/binding-win32-x64-gnu/package.json").version;
3596
- 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.`);
3597
- return binding;
3598
- } catch (e) {
3599
- loadErrors.push(e);
3600
- }
3601
- } else {
3602
- try {
3603
- return __require("./rolldown-binding.win32-x64-msvc.node");
3604
- } catch (e) {
3605
- loadErrors.push(e);
3606
- }
3607
- try {
3608
- const binding = __require("@rolldown/binding-win32-x64-msvc");
3609
- const bindingPackageVersion = __require("@rolldown/binding-win32-x64-msvc/package.json").version;
3610
- 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.`);
3611
- return binding;
3612
- } catch (e) {
3613
- loadErrors.push(e);
3614
- }
3615
- }
3616
- else if (process.arch === "ia32") {
3617
- try {
3618
- return __require("./rolldown-binding.win32-ia32-msvc.node");
3619
- } catch (e) {
3620
- loadErrors.push(e);
3621
- }
3622
- try {
3623
- const binding = __require("@rolldown/binding-win32-ia32-msvc");
3624
- const bindingPackageVersion = __require("@rolldown/binding-win32-ia32-msvc/package.json").version;
3625
- 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.`);
3626
- return binding;
3627
- } catch (e) {
3628
- loadErrors.push(e);
3629
- }
3630
- } else if (process.arch === "arm64") {
3631
- try {
3632
- return __require("./rolldown-binding.win32-arm64-msvc.node");
3633
- } catch (e) {
3634
- loadErrors.push(e);
3635
- }
3636
- try {
3637
- const binding = __require("@rolldown/binding-win32-arm64-msvc");
3638
- const bindingPackageVersion = __require("@rolldown/binding-win32-arm64-msvc/package.json").version;
3639
- 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.`);
3640
- return binding;
3641
- } catch (e) {
3642
- loadErrors.push(e);
3643
- }
3644
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Windows: ${process.arch}`));
3645
- else if (process.platform === "darwin") {
3646
- try {
3647
- return __require("./rolldown-binding.darwin-universal.node");
3648
- } catch (e) {
3649
- loadErrors.push(e);
3650
- }
3651
- try {
3652
- const binding = __require("@rolldown/binding-darwin-universal");
3653
- const bindingPackageVersion = __require("@rolldown/binding-darwin-universal/package.json").version;
3654
- 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.`);
3655
- return binding;
3656
- } catch (e) {
3657
- loadErrors.push(e);
3658
- }
3659
- if (process.arch === "x64") {
3660
- try {
3661
- return __require("./rolldown-binding.darwin-x64.node");
3662
- } catch (e) {
3663
- loadErrors.push(e);
3664
- }
3665
- try {
3666
- const binding = __require("@rolldown/binding-darwin-x64");
3667
- const bindingPackageVersion = __require("@rolldown/binding-darwin-x64/package.json").version;
3668
- 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.`);
3669
- return binding;
3670
- } catch (e) {
3671
- loadErrors.push(e);
3672
- }
3673
- } else if (process.arch === "arm64") {
3674
- try {
3675
- return __require("./rolldown-binding.darwin-arm64.node");
3676
- } catch (e) {
3677
- loadErrors.push(e);
3678
- }
3679
- try {
3680
- const binding = __require("@rolldown/binding-darwin-arm64");
3681
- const bindingPackageVersion = __require("@rolldown/binding-darwin-arm64/package.json").version;
3682
- 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.`);
3683
- return binding;
3684
- } catch (e) {
3685
- loadErrors.push(e);
3686
- }
3687
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on macOS: ${process.arch}`));
3688
- } else if (process.platform === "freebsd") if (process.arch === "x64") {
3689
- try {
3690
- return __require("./rolldown-binding.freebsd-x64.node");
3691
- } catch (e) {
3692
- loadErrors.push(e);
3693
- }
3694
- try {
3695
- const binding = __require("@rolldown/binding-freebsd-x64");
3696
- const bindingPackageVersion = __require("@rolldown/binding-freebsd-x64/package.json").version;
3697
- 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.`);
3698
- return binding;
3699
- } catch (e) {
3700
- loadErrors.push(e);
3701
- }
3702
- } else if (process.arch === "arm64") {
3703
- try {
3704
- return __require("./rolldown-binding.freebsd-arm64.node");
3705
- } catch (e) {
3706
- loadErrors.push(e);
3707
- }
3708
- try {
3709
- const binding = __require("@rolldown/binding-freebsd-arm64");
3710
- const bindingPackageVersion = __require("@rolldown/binding-freebsd-arm64/package.json").version;
3711
- 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.`);
3712
- return binding;
3713
- } catch (e) {
3714
- loadErrors.push(e);
3715
- }
3716
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
3717
- else if (process.platform === "linux") if (process.arch === "x64") if (isMusl()) {
3718
- try {
3719
- return __require("./rolldown-binding.linux-x64-musl.node");
3720
- } catch (e) {
3721
- loadErrors.push(e);
3722
- }
3723
- try {
3724
- const binding = __require("@rolldown/binding-linux-x64-musl");
3725
- const bindingPackageVersion = __require("@rolldown/binding-linux-x64-musl/package.json").version;
3726
- 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.`);
3727
- return binding;
3728
- } catch (e) {
3729
- loadErrors.push(e);
3730
- }
3731
- } else {
3732
- try {
3733
- return __require("../rolldown-binding.linux-x64-gnu.node");
3734
- } catch (e) {
3735
- loadErrors.push(e);
3736
- }
3737
- try {
3738
- const binding = __require("@rolldown/binding-linux-x64-gnu");
3739
- const bindingPackageVersion = __require("@rolldown/binding-linux-x64-gnu/package.json").version;
3740
- 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.`);
3741
- return binding;
3742
- } catch (e) {
3743
- loadErrors.push(e);
3744
- }
3745
- }
3746
- else if (process.arch === "arm64") if (isMusl()) {
3747
- try {
3748
- return __require("./rolldown-binding.linux-arm64-musl.node");
3749
- } catch (e) {
3750
- loadErrors.push(e);
3751
- }
3752
- try {
3753
- const binding = __require("@rolldown/binding-linux-arm64-musl");
3754
- const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-musl/package.json").version;
3755
- 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.`);
3756
- return binding;
3757
- } catch (e) {
3758
- loadErrors.push(e);
3759
- }
3760
- } else {
3761
- try {
3762
- return __require("./rolldown-binding.linux-arm64-gnu.node");
3763
- } catch (e) {
3764
- loadErrors.push(e);
3765
- }
3766
- try {
3767
- const binding = __require("@rolldown/binding-linux-arm64-gnu");
3768
- const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-gnu/package.json").version;
3769
- 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.`);
3770
- return binding;
3771
- } catch (e) {
3772
- loadErrors.push(e);
3773
- }
3774
- }
3775
- else if (process.arch === "arm") if (isMusl()) {
3776
- try {
3777
- return __require("./rolldown-binding.linux-arm-musleabihf.node");
3778
- } catch (e) {
3779
- loadErrors.push(e);
3780
- }
3781
- try {
3782
- const binding = __require("@rolldown/binding-linux-arm-musleabihf");
3783
- const bindingPackageVersion = __require("@rolldown/binding-linux-arm-musleabihf/package.json").version;
3784
- 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.`);
3785
- return binding;
3786
- } catch (e) {
3787
- loadErrors.push(e);
3788
- }
3789
- } else {
3790
- try {
3791
- return __require("./rolldown-binding.linux-arm-gnueabihf.node");
3792
- } catch (e) {
3793
- loadErrors.push(e);
3794
- }
3795
- try {
3796
- const binding = __require("@rolldown/binding-linux-arm-gnueabihf");
3797
- const bindingPackageVersion = __require("@rolldown/binding-linux-arm-gnueabihf/package.json").version;
3798
- 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.`);
3799
- return binding;
3800
- } catch (e) {
3801
- loadErrors.push(e);
3802
- }
3803
- }
3804
- else if (process.arch === "loong64") if (isMusl()) {
3805
- try {
3806
- return __require("./rolldown-binding.linux-loong64-musl.node");
3807
- } catch (e) {
3808
- loadErrors.push(e);
3809
- }
3810
- try {
3811
- const binding = __require("@rolldown/binding-linux-loong64-musl");
3812
- const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-musl/package.json").version;
3813
- 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.`);
3814
- return binding;
3815
- } catch (e) {
3816
- loadErrors.push(e);
3817
- }
3818
- } else {
3819
- try {
3820
- return __require("./rolldown-binding.linux-loong64-gnu.node");
3821
- } catch (e) {
3822
- loadErrors.push(e);
3823
- }
3824
- try {
3825
- const binding = __require("@rolldown/binding-linux-loong64-gnu");
3826
- const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-gnu/package.json").version;
3827
- 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.`);
3828
- return binding;
3829
- } catch (e) {
3830
- loadErrors.push(e);
3831
- }
3832
- }
3833
- else if (process.arch === "riscv64") if (isMusl()) {
3834
- try {
3835
- return __require("./rolldown-binding.linux-riscv64-musl.node");
3836
- } catch (e) {
3837
- loadErrors.push(e);
3838
- }
3839
- try {
3840
- const binding = __require("@rolldown/binding-linux-riscv64-musl");
3841
- const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-musl/package.json").version;
3842
- 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.`);
3843
- return binding;
3844
- } catch (e) {
3845
- loadErrors.push(e);
3846
- }
3847
- } else {
3848
- try {
3849
- return __require("./rolldown-binding.linux-riscv64-gnu.node");
3850
- } catch (e) {
3851
- loadErrors.push(e);
3852
- }
3853
- try {
3854
- const binding = __require("@rolldown/binding-linux-riscv64-gnu");
3855
- const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-gnu/package.json").version;
3856
- 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.`);
3857
- return binding;
3858
- } catch (e) {
3859
- loadErrors.push(e);
3860
- }
3861
- }
3862
- else if (process.arch === "ppc64") {
3863
- try {
3864
- return __require("./rolldown-binding.linux-ppc64-gnu.node");
3865
- } catch (e) {
3866
- loadErrors.push(e);
3867
- }
3868
- try {
3869
- const binding = __require("@rolldown/binding-linux-ppc64-gnu");
3870
- const bindingPackageVersion = __require("@rolldown/binding-linux-ppc64-gnu/package.json").version;
3871
- 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.`);
3872
- return binding;
3873
- } catch (e) {
3874
- loadErrors.push(e);
3875
- }
3876
- } else if (process.arch === "s390x") {
3877
- try {
3878
- return __require("./rolldown-binding.linux-s390x-gnu.node");
3879
- } catch (e) {
3880
- loadErrors.push(e);
3881
- }
3882
- try {
3883
- const binding = __require("@rolldown/binding-linux-s390x-gnu");
3884
- const bindingPackageVersion = __require("@rolldown/binding-linux-s390x-gnu/package.json").version;
3885
- 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.`);
3886
- return binding;
3887
- } catch (e) {
3888
- loadErrors.push(e);
3889
- }
3890
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Linux: ${process.arch}`));
3891
- else if (process.platform === "openharmony") if (process.arch === "arm64") {
3892
- try {
3893
- return __require("./rolldown-binding.openharmony-arm64.node");
3894
- } catch (e) {
3895
- loadErrors.push(e);
3896
- }
3897
- try {
3898
- const binding = __require("@rolldown/binding-openharmony-arm64");
3899
- const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm64/package.json").version;
3900
- 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.`);
3901
- return binding;
3902
- } catch (e) {
3903
- loadErrors.push(e);
3904
- }
3905
- } else if (process.arch === "x64") {
3906
- try {
3907
- return __require("./rolldown-binding.openharmony-x64.node");
3908
- } catch (e) {
3909
- loadErrors.push(e);
3910
- }
3911
- try {
3912
- const binding = __require("@rolldown/binding-openharmony-x64");
3913
- const bindingPackageVersion = __require("@rolldown/binding-openharmony-x64/package.json").version;
3914
- 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.`);
3915
- return binding;
3916
- } catch (e) {
3917
- loadErrors.push(e);
3918
- }
3919
- } else if (process.arch === "arm") {
3920
- try {
3921
- return __require("./rolldown-binding.openharmony-arm.node");
3922
- } catch (e) {
3923
- loadErrors.push(e);
3924
- }
3925
- try {
3926
- const binding = __require("@rolldown/binding-openharmony-arm");
3927
- const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm/package.json").version;
3928
- 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.`);
3929
- return binding;
3930
- } catch (e) {
3931
- loadErrors.push(e);
3932
- }
3933
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
3934
- else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
3935
- }
3936
- nativeBinding = requireNative();
3937
- if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
3938
- let wasiBinding = null;
3939
- let wasiBindingError = null;
3940
- try {
3941
- wasiBinding = __require("../rolldown-binding.wasi.cjs");
3942
- nativeBinding = wasiBinding;
3943
- } catch (err) {
3944
- if (process.env.NAPI_RS_FORCE_WASI) wasiBindingError = err;
3945
- }
3946
- if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) try {
3947
- wasiBinding = __require("@rolldown/binding-wasm32-wasi");
3948
- nativeBinding = wasiBinding;
3949
- } catch (err) {
3950
- if (process.env.NAPI_RS_FORCE_WASI) {
3951
- if (!wasiBindingError) wasiBindingError = err;
3952
- else wasiBindingError.cause = err;
3953
- loadErrors.push(err);
3954
- }
3955
- }
3956
- if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
3957
- const error = /* @__PURE__ */ new Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
3958
- error.cause = wasiBindingError;
3959
- throw error;
3960
- }
3961
- }
3962
- if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) try {
3963
- nativeBinding = require_webcontainer_fallback();
3964
- } catch (err) {
3965
- loadErrors.push(err);
3966
- }
3967
- if (!nativeBinding) {
3968
- 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) => {
3969
- cur.cause = err;
3970
- return cur;
3971
- }) });
3972
- throw new Error(`Failed to load native binding`);
3973
- }
3974
- module.exports = nativeBinding;
3975
- module.exports.minify = nativeBinding.minify;
3976
- module.exports.minifySync = nativeBinding.minifySync;
3977
- module.exports.Severity = nativeBinding.Severity;
3978
- module.exports.ParseResult = nativeBinding.ParseResult;
3979
- module.exports.ExportExportNameKind = nativeBinding.ExportExportNameKind;
3980
- module.exports.ExportImportNameKind = nativeBinding.ExportImportNameKind;
3981
- module.exports.ExportLocalNameKind = nativeBinding.ExportLocalNameKind;
3982
- module.exports.ImportNameKind = nativeBinding.ImportNameKind;
3983
- module.exports.parse = nativeBinding.parse;
3984
- module.exports.parseSync = nativeBinding.parseSync;
3985
- module.exports.rawTransferSupported = nativeBinding.rawTransferSupported;
3986
- module.exports.ResolverFactory = nativeBinding.ResolverFactory;
3987
- module.exports.EnforceExtension = nativeBinding.EnforceExtension;
3988
- module.exports.ModuleType = nativeBinding.ModuleType;
3989
- module.exports.sync = nativeBinding.sync;
3990
- module.exports.HelperMode = nativeBinding.HelperMode;
3991
- module.exports.isolatedDeclaration = nativeBinding.isolatedDeclaration;
3992
- module.exports.isolatedDeclarationSync = nativeBinding.isolatedDeclarationSync;
3993
- module.exports.moduleRunnerTransform = nativeBinding.moduleRunnerTransform;
3994
- module.exports.moduleRunnerTransformSync = nativeBinding.moduleRunnerTransformSync;
3995
- module.exports.transform = nativeBinding.transform;
3996
- module.exports.transformSync = nativeBinding.transformSync;
3997
- module.exports.BindingBundleEndEventData = nativeBinding.BindingBundleEndEventData;
3998
- module.exports.BindingBundleErrorEventData = nativeBinding.BindingBundleErrorEventData;
3999
- module.exports.BindingBundler = nativeBinding.BindingBundler;
4000
- module.exports.BindingCallableBuiltinPlugin = nativeBinding.BindingCallableBuiltinPlugin;
4001
- module.exports.BindingChunkingContext = nativeBinding.BindingChunkingContext;
4002
- module.exports.BindingDecodedMap = nativeBinding.BindingDecodedMap;
4003
- module.exports.BindingDevEngine = nativeBinding.BindingDevEngine;
4004
- module.exports.BindingLoadPluginContext = nativeBinding.BindingLoadPluginContext;
4005
- module.exports.BindingMagicString = nativeBinding.BindingMagicString;
4006
- module.exports.BindingModuleInfo = nativeBinding.BindingModuleInfo;
4007
- module.exports.BindingNormalizedOptions = nativeBinding.BindingNormalizedOptions;
4008
- module.exports.BindingOutputAsset = nativeBinding.BindingOutputAsset;
4009
- module.exports.BindingOutputChunk = nativeBinding.BindingOutputChunk;
4010
- module.exports.BindingPluginContext = nativeBinding.BindingPluginContext;
4011
- module.exports.BindingRenderedChunk = nativeBinding.BindingRenderedChunk;
4012
- module.exports.BindingRenderedChunkMeta = nativeBinding.BindingRenderedChunkMeta;
4013
- module.exports.BindingRenderedModule = nativeBinding.BindingRenderedModule;
4014
- module.exports.BindingSourceMap = nativeBinding.BindingSourceMap;
4015
- module.exports.BindingTransformPluginContext = nativeBinding.BindingTransformPluginContext;
4016
- module.exports.BindingWatcher = nativeBinding.BindingWatcher;
4017
- module.exports.BindingWatcherBundler = nativeBinding.BindingWatcherBundler;
4018
- module.exports.BindingWatcherChangeData = nativeBinding.BindingWatcherChangeData;
4019
- module.exports.BindingWatcherEvent = nativeBinding.BindingWatcherEvent;
4020
- module.exports.ParallelJsPluginRegistry = nativeBinding.ParallelJsPluginRegistry;
4021
- module.exports.ScheduledBuild = nativeBinding.ScheduledBuild;
4022
- module.exports.TraceSubscriberGuard = nativeBinding.TraceSubscriberGuard;
4023
- module.exports.TsconfigCache = nativeBinding.TsconfigCache;
4024
- module.exports.BindingAttachDebugInfo = nativeBinding.BindingAttachDebugInfo;
4025
- module.exports.BindingBuiltinPluginName = nativeBinding.BindingBuiltinPluginName;
4026
- module.exports.BindingChunkModuleOrderBy = nativeBinding.BindingChunkModuleOrderBy;
4027
- module.exports.BindingLogLevel = nativeBinding.BindingLogLevel;
4028
- module.exports.BindingPluginOrder = nativeBinding.BindingPluginOrder;
4029
- module.exports.BindingPropertyReadSideEffects = nativeBinding.BindingPropertyReadSideEffects;
4030
- module.exports.BindingPropertyWriteSideEffects = nativeBinding.BindingPropertyWriteSideEffects;
4031
- module.exports.BindingRebuildStrategy = nativeBinding.BindingRebuildStrategy;
4032
- module.exports.collapseSourcemaps = nativeBinding.collapseSourcemaps;
4033
- module.exports.enhancedTransform = nativeBinding.enhancedTransform;
4034
- module.exports.enhancedTransformSync = nativeBinding.enhancedTransformSync;
4035
- module.exports.FilterTokenKind = nativeBinding.FilterTokenKind;
4036
- module.exports.initTraceSubscriber = nativeBinding.initTraceSubscriber;
4037
- module.exports.registerPlugins = nativeBinding.registerPlugins;
4038
- module.exports.resolveTsconfig = nativeBinding.resolveTsconfig;
4039
- module.exports.shutdownAsyncRuntime = nativeBinding.shutdownAsyncRuntime;
4040
- module.exports.startAsyncRuntime = nativeBinding.startAsyncRuntime;
4041
- }));
4042
- //#endregion
4043
- //#region node_modules/.pnpm/rolldown@1.0.0/node_modules/rolldown/dist/shared/logs-D80CXhvg.mjs
4044
- const PLUGIN_ERROR = "PLUGIN_ERROR";
4045
- function logPluginError(error, plugin, { hook, id } = {}) {
4046
- try {
4047
- const code = error.code;
4048
- if (!error.pluginCode && code != null && (typeof code !== "string" || !code.startsWith("PLUGIN_"))) error.pluginCode = code;
4049
- error.code = PLUGIN_ERROR;
4050
- error.plugin = plugin;
4051
- if (hook) error.hook = hook;
4052
- if (id) error.id = id;
4053
- } catch (_) {} finally {
4054
- return error;
4055
- }
4056
- }
4057
- function error(base) {
4058
- if (!(base instanceof Error)) {
4059
- base = Object.assign(new Error(base.message), base);
4060
- Object.defineProperty(base, "name", {
4061
- value: "RolldownError",
4062
- writable: true
4063
- });
4064
- }
4065
- throw base;
4066
- }
4067
- //#endregion
4068
- //#region node_modules/.pnpm/rolldown@1.0.0/node_modules/rolldown/dist/shared/normalize-string-or-regex-dAjLOSbp.mjs
4069
- var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
4070
- var BuiltinPlugin = class {
4071
- name;
4072
- _options;
4073
- /** Vite-specific option to control plugin ordering */
4074
- enforce;
4075
- constructor(name, _options) {
4076
- this.name = name;
4077
- this._options = _options;
4078
- }
4079
- };
4080
- function makeBuiltinPluginCallable(plugin) {
4081
- let callablePlugin = new import_binding.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
4082
- const wrappedPlugin = plugin;
4083
- for (const key in callablePlugin) {
4084
- const wrappedHook = async function(...args) {
4085
- try {
4086
- return await callablePlugin[key](...args);
4087
- } catch (e) {
4088
- if (e instanceof Error && !e.stack?.includes("at ")) Error.captureStackTrace(e, wrappedPlugin[key]);
4089
- return error(logPluginError(e, plugin.name, {
4090
- hook: key,
4091
- id: key === "transform" ? args[2] : void 0
4092
- }));
4093
- }
4094
- };
4095
- const order = callablePlugin.getOrder(key);
4096
- if (order == void 0) wrappedPlugin[key] = wrappedHook;
4097
- else wrappedPlugin[key] = {
4098
- handler: wrappedHook,
4099
- order
4100
- };
4101
- }
4102
- return wrappedPlugin;
4103
- }
4104
- function bindingifyBuiltInPlugin(plugin) {
4105
- return {
4106
- __name: plugin.name,
4107
- options: plugin._options
4108
- };
4109
- }
4110
- //#endregion
4111
- //#region node_modules/.pnpm/rolldown@1.0.0/node_modules/rolldown/dist/plugins-index.mjs
4112
- /**
4113
- * Replaces targeted strings in files while bundling.
4114
- *
4115
- * @example
4116
- * **Basic usage**
4117
- * ```js
4118
- * replacePlugin({
4119
- * 'process.env.NODE_ENV': JSON.stringify('production'),
4120
- * __buildVersion: 15
4121
- * })
4122
- * ```
4123
- * @example
4124
- * **With options**
4125
- * ```js
4126
- * replacePlugin({
4127
- * 'process.env.NODE_ENV': JSON.stringify('production'),
4128
- * __buildVersion: 15
4129
- * }, {
4130
- * preventAssignment: false,
4131
- * })
4132
- * ```
4133
- *
4134
- * @see https://rolldown.rs/builtin-plugins/replace
4135
- * @category Builtin Plugins
4136
- */
4137
- function replacePlugin(values = {}, options = {}) {
4138
- Object.keys(values).forEach((key) => {
4139
- const value = values[key];
4140
- if (typeof value !== "string") values[key] = String(value);
4141
- });
4142
- return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:replace", {
4143
- ...options,
4144
- values
4145
- }));
4146
- }
4147
- //#endregion
4148
3468
  //#region src/cli.ts
4149
3469
  const NODE_ENV = process$1.env.NODE_ENV || "production";
4150
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-ZmVRYzq_.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.4",
3
+ "version": "0.1.5",
4
4
  "description": "基于 @unmagic/vue-mini 的Vue3 单文件组件构建工具",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",