weapp-vite 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import '../dist/cli.mjs'
package/bin/weapp-vite.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import '../dist/cli.js'
2
+ require('../dist/cli.cjs')
@@ -1,12 +1,14 @@
1
1
  import {
2
2
  __commonJS,
3
- __require
4
- } from "./chunk-MCKGQKYU.js";
3
+ __require,
4
+ init_esm_shims
5
+ } from "./chunk-3276ZVN4.mjs";
5
6
 
6
7
  // ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js
7
8
  var require_constants = __commonJS({
8
9
  "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js"(exports, module) {
9
10
  "use strict";
11
+ init_esm_shims();
10
12
  var path = __require("path");
11
13
  var WIN_SLASH = "\\\\/";
12
14
  var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
@@ -204,6 +206,7 @@ var require_constants = __commonJS({
204
206
  var require_utils = __commonJS({
205
207
  "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js"(exports) {
206
208
  "use strict";
209
+ init_esm_shims();
207
210
  var path = __require("path");
208
211
  var win32 = process.platform === "win32";
209
212
  var {
@@ -265,6 +268,7 @@ var require_utils = __commonJS({
265
268
  var require_scan = __commonJS({
266
269
  "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/scan.js"(exports, module) {
267
270
  "use strict";
271
+ init_esm_shims();
268
272
  var utils = require_utils();
269
273
  var {
270
274
  CHAR_ASTERISK,
@@ -595,6 +599,7 @@ var require_scan = __commonJS({
595
599
  var require_parse = __commonJS({
596
600
  "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/parse.js"(exports, module) {
597
601
  "use strict";
602
+ init_esm_shims();
598
603
  var constants = require_constants();
599
604
  var utils = require_utils();
600
605
  var {
@@ -1368,6 +1373,7 @@ var require_parse = __commonJS({
1368
1373
  var require_picomatch = __commonJS({
1369
1374
  "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js"(exports, module) {
1370
1375
  "use strict";
1376
+ init_esm_shims();
1371
1377
  var path = __require("path");
1372
1378
  var scan = require_scan();
1373
1379
  var parse = require_parse();
@@ -1509,6 +1515,7 @@ var require_picomatch = __commonJS({
1509
1515
  var require_picomatch2 = __commonJS({
1510
1516
  "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/index.js"(exports, module) {
1511
1517
  "use strict";
1518
+ init_esm_shims();
1512
1519
  module.exports = require_picomatch();
1513
1520
  }
1514
1521
  });
@@ -1517,6 +1524,7 @@ var require_picomatch2 = __commonJS({
1517
1524
  var require_readdirp = __commonJS({
1518
1525
  "../../node_modules/.pnpm/readdirp@3.6.0/node_modules/readdirp/index.js"(exports, module) {
1519
1526
  "use strict";
1527
+ init_esm_shims();
1520
1528
  var fs = __require("fs");
1521
1529
  var { Readable } = __require("stream");
1522
1530
  var sysPath = __require("path");
@@ -1747,6 +1755,7 @@ var require_readdirp = __commonJS({
1747
1755
  var require_normalize_path = __commonJS({
1748
1756
  "../../node_modules/.pnpm/normalize-path@3.0.0/node_modules/normalize-path/index.js"(exports, module) {
1749
1757
  "use strict";
1758
+ init_esm_shims();
1750
1759
  module.exports = function(path, stripTrailing) {
1751
1760
  if (typeof path !== "string") {
1752
1761
  throw new TypeError("expected path to be a string");
@@ -1775,6 +1784,7 @@ var require_normalize_path = __commonJS({
1775
1784
  var require_anymatch = __commonJS({
1776
1785
  "../../node_modules/.pnpm/anymatch@3.1.3/node_modules/anymatch/index.js"(exports, module) {
1777
1786
  "use strict";
1787
+ init_esm_shims();
1778
1788
  Object.defineProperty(exports, "__esModule", { value: true });
1779
1789
  var picomatch = require_picomatch2();
1780
1790
  var normalizePath = require_normalize_path();
@@ -1842,6 +1852,7 @@ var require_anymatch = __commonJS({
1842
1852
  var require_is_extglob = __commonJS({
1843
1853
  "../../node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js"(exports, module) {
1844
1854
  "use strict";
1855
+ init_esm_shims();
1845
1856
  module.exports = function isExtglob(str) {
1846
1857
  if (typeof str !== "string" || str === "") {
1847
1858
  return false;
@@ -1860,6 +1871,7 @@ var require_is_extglob = __commonJS({
1860
1871
  var require_is_glob = __commonJS({
1861
1872
  "../../node_modules/.pnpm/is-glob@4.0.3/node_modules/is-glob/index.js"(exports, module) {
1862
1873
  "use strict";
1874
+ init_esm_shims();
1863
1875
  var isExtglob = require_is_extglob();
1864
1876
  var chars = { "{": "}", "(": ")", "[": "]" };
1865
1877
  var strictCheck = function(str) {
@@ -1992,6 +2004,7 @@ var require_is_glob = __commonJS({
1992
2004
  var require_glob_parent = __commonJS({
1993
2005
  "../../node_modules/.pnpm/glob-parent@5.1.2/node_modules/glob-parent/index.js"(exports, module) {
1994
2006
  "use strict";
2007
+ init_esm_shims();
1995
2008
  var isGlob = require_is_glob();
1996
2009
  var pathPosixDirname = __require("path").posix.dirname;
1997
2010
  var isWin32 = __require("os").platform() === "win32";
@@ -2021,6 +2034,7 @@ var require_glob_parent = __commonJS({
2021
2034
  var require_utils2 = __commonJS({
2022
2035
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js"(exports) {
2023
2036
  "use strict";
2037
+ init_esm_shims();
2024
2038
  exports.isInteger = (num) => {
2025
2039
  if (typeof num === "number") {
2026
2040
  return Number.isInteger(num);
@@ -2103,6 +2117,7 @@ var require_utils2 = __commonJS({
2103
2117
  var require_stringify = __commonJS({
2104
2118
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js"(exports, module) {
2105
2119
  "use strict";
2120
+ init_esm_shims();
2106
2121
  var utils = require_utils2();
2107
2122
  module.exports = (ast, options = {}) => {
2108
2123
  const stringify = (node, parent = {}) => {
@@ -2134,6 +2149,7 @@ var require_stringify = __commonJS({
2134
2149
  var require_is_number = __commonJS({
2135
2150
  "../../node_modules/.pnpm/is-number@7.0.0/node_modules/is-number/index.js"(exports, module) {
2136
2151
  "use strict";
2152
+ init_esm_shims();
2137
2153
  module.exports = function(num) {
2138
2154
  if (typeof num === "number") {
2139
2155
  return num - num === 0;
@@ -2150,6 +2166,7 @@ var require_is_number = __commonJS({
2150
2166
  var require_to_regex_range = __commonJS({
2151
2167
  "../../node_modules/.pnpm/to-regex-range@5.0.1/node_modules/to-regex-range/index.js"(exports, module) {
2152
2168
  "use strict";
2169
+ init_esm_shims();
2153
2170
  var isNumber = require_is_number();
2154
2171
  var toRegexRange = (min, max, options) => {
2155
2172
  if (isNumber(min) === false) {
@@ -2361,6 +2378,7 @@ var require_to_regex_range = __commonJS({
2361
2378
  var require_fill_range = __commonJS({
2362
2379
  "../../node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js"(exports, module) {
2363
2380
  "use strict";
2381
+ init_esm_shims();
2364
2382
  var util = __require("util");
2365
2383
  var toRegexRange = require_to_regex_range();
2366
2384
  var isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
@@ -2555,6 +2573,7 @@ var require_fill_range = __commonJS({
2555
2573
  var require_compile = __commonJS({
2556
2574
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/compile.js"(exports, module) {
2557
2575
  "use strict";
2576
+ init_esm_shims();
2558
2577
  var fill = require_fill_range();
2559
2578
  var utils = require_utils2();
2560
2579
  var compile = (ast, options = {}) => {
@@ -2607,6 +2626,7 @@ var require_compile = __commonJS({
2607
2626
  var require_expand = __commonJS({
2608
2627
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/expand.js"(exports, module) {
2609
2628
  "use strict";
2629
+ init_esm_shims();
2610
2630
  var fill = require_fill_range();
2611
2631
  var stringify = require_stringify();
2612
2632
  var utils = require_utils2();
@@ -2701,6 +2721,7 @@ var require_expand = __commonJS({
2701
2721
  var require_constants2 = __commonJS({
2702
2722
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/constants.js"(exports, module) {
2703
2723
  "use strict";
2724
+ init_esm_shims();
2704
2725
  module.exports = {
2705
2726
  MAX_LENGTH: 1e4,
2706
2727
  // Digits
@@ -2802,6 +2823,7 @@ var require_constants2 = __commonJS({
2802
2823
  var require_parse2 = __commonJS({
2803
2824
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js"(exports, module) {
2804
2825
  "use strict";
2826
+ init_esm_shims();
2805
2827
  var stringify = require_stringify();
2806
2828
  var {
2807
2829
  MAX_LENGTH,
@@ -3040,6 +3062,7 @@ var require_parse2 = __commonJS({
3040
3062
  var require_braces = __commonJS({
3041
3063
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/index.js"(exports, module) {
3042
3064
  "use strict";
3065
+ init_esm_shims();
3043
3066
  var stringify = require_stringify();
3044
3067
  var compile = require_compile();
3045
3068
  var expand = require_expand();
@@ -3372,6 +3395,7 @@ var require_binary_extensions = __commonJS({
3372
3395
  var require_binary_extensions2 = __commonJS({
3373
3396
  "../../node_modules/.pnpm/binary-extensions@2.3.0/node_modules/binary-extensions/index.js"(exports, module) {
3374
3397
  "use strict";
3398
+ init_esm_shims();
3375
3399
  module.exports = require_binary_extensions();
3376
3400
  }
3377
3401
  });
@@ -3380,6 +3404,7 @@ var require_binary_extensions2 = __commonJS({
3380
3404
  var require_is_binary_path = __commonJS({
3381
3405
  "../../node_modules/.pnpm/is-binary-path@2.1.0/node_modules/is-binary-path/index.js"(exports, module) {
3382
3406
  "use strict";
3407
+ init_esm_shims();
3383
3408
  var path = __require("path");
3384
3409
  var binaryExtensions = require_binary_extensions2();
3385
3410
  var extensions = new Set(binaryExtensions);
@@ -3391,6 +3416,7 @@ var require_is_binary_path = __commonJS({
3391
3416
  var require_constants3 = __commonJS({
3392
3417
  "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/constants.js"(exports) {
3393
3418
  "use strict";
3419
+ init_esm_shims();
3394
3420
  var { sep } = __require("path");
3395
3421
  var { platform } = process;
3396
3422
  var os = __require("os");
@@ -3455,6 +3481,7 @@ var require_constants3 = __commonJS({
3455
3481
  var require_nodefs_handler = __commonJS({
3456
3482
  "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/nodefs-handler.js"(exports, module) {
3457
3483
  "use strict";
3484
+ init_esm_shims();
3458
3485
  var fs = __require("fs");
3459
3486
  var sysPath = __require("path");
3460
3487
  var { promisify } = __require("util");
@@ -3946,6 +3973,7 @@ var require_nodefs_handler = __commonJS({
3946
3973
  var require_fsevents_handler = __commonJS({
3947
3974
  "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/fsevents-handler.js"(exports, module) {
3948
3975
  "use strict";
3976
+ init_esm_shims();
3949
3977
  var fs = __require("fs");
3950
3978
  var sysPath = __require("path");
3951
3979
  var { promisify } = __require("util");
@@ -4341,6 +4369,7 @@ var require_fsevents_handler = __commonJS({
4341
4369
  // ../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/index.js
4342
4370
  var require_chokidar = __commonJS({
4343
4371
  "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/index.js"(exports) {
4372
+ init_esm_shims();
4344
4373
  var { EventEmitter } = __require("events");
4345
4374
  var fs = __require("fs");
4346
4375
  var sysPath = __require("path");
@@ -5,11 +5,22 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
5
5
  if (typeof require !== "undefined") return require.apply(this, arguments);
6
6
  throw Error('Dynamic require of "' + x + '" is not supported');
7
7
  });
8
+ var __esm = (fn, res) => function __init() {
9
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
+ };
8
11
  var __commonJS = (cb, mod) => function __require2() {
9
12
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
13
  };
11
14
 
15
+ // ../../node_modules/.pnpm/tsup@8.2.4_jiti@1.21.6_postcss@8.4.41_tsx@4.17.0_typescript@5.5.4_yaml@2.5.0/node_modules/tsup/assets/esm_shims.js
16
+ var init_esm_shims = __esm({
17
+ "../../node_modules/.pnpm/tsup@8.2.4_jiti@1.21.6_postcss@8.4.41_tsx@4.17.0_typescript@5.5.4_yaml@2.5.0/node_modules/tsup/assets/esm_shims.js"() {
18
+ "use strict";
19
+ }
20
+ });
21
+
12
22
  export {
13
23
  __require,
14
- __commonJS
24
+ __commonJS,
25
+ init_esm_shims
15
26
  };
@@ -1,12 +1,17 @@
1
+ import {
2
+ init_esm_shims
3
+ } from "./chunk-3276ZVN4.mjs";
4
+
1
5
  // src/build.ts
6
+ init_esm_shims();
2
7
  import process2 from "node:process";
3
- import { build } from "vite";
4
8
  import { addExtension as addExtension3, defu as defu3, removeExtension as removeExtension3 } from "@weapp-core/shared";
5
9
  import { readPackageJSON } from "pkg-types";
6
10
  import path5 from "pathe";
7
11
  import tsconfigPaths from "vite-tsconfig-paths";
8
12
 
9
13
  // src/plugins/index.ts
14
+ init_esm_shims();
10
15
  import path4 from "pathe";
11
16
  import fs3 from "fs-extra";
12
17
  import MagicString from "magic-string";
@@ -14,7 +19,11 @@ import { addExtension as addExtension2, removeExtension as removeExtension2 } fr
14
19
  import { isCSSRequest, preprocessCSS } from "vite";
15
20
  import fg from "fast-glob";
16
21
 
22
+ // src/utils/index.ts
23
+ init_esm_shims();
24
+
17
25
  // src/utils/scan.ts
26
+ init_esm_shims();
18
27
  import path from "pathe";
19
28
  import fs from "fs-extra";
20
29
  import { addExtension, defu, isObject, removeExtension } from "@weapp-core/shared";
@@ -123,6 +132,7 @@ function getWxmlEntry(wxmlPath, formatPath) {
123
132
  }
124
133
 
125
134
  // src/utils/projectConfig.ts
135
+ init_esm_shims();
126
136
  import path2 from "pathe";
127
137
  import fs2 from "fs-extra";
128
138
  function getProjectConfig(root, options) {
@@ -156,6 +166,7 @@ var supportedCssLangs = ["wxss", "scss", "less", "sass", "styl"];
156
166
  var supportedCssExtensions = supportedCssLangs.map((x) => `.${x}`);
157
167
 
158
168
  // src/entry.ts
169
+ init_esm_shims();
159
170
  import process from "node:process";
160
171
  import mm from "micromatch";
161
172
  import { defu as defu2 } from "@weapp-core/shared";
@@ -280,6 +291,7 @@ async function getEntries(options) {
280
291
  }
281
292
 
282
293
  // src/debugger.ts
294
+ init_esm_shims();
283
295
  import createDebug from "debug";
284
296
  function createDebugger(namespace) {
285
297
  const debug2 = createDebug(namespace);
@@ -289,6 +301,7 @@ function createDebugger(namespace) {
289
301
  }
290
302
 
291
303
  // src/plugins/parse.ts
304
+ init_esm_shims();
292
305
  function parseRequest(id) {
293
306
  const [filename, rawQuery] = id.split(`?`, 2);
294
307
  const query = Object.fromEntries(new URLSearchParams(rawQuery));
@@ -343,10 +356,10 @@ function vitePluginWeapp(ctx) {
343
356
  configResolved = config;
344
357
  },
345
358
  async options(options) {
346
- const { root, build: build2, weapp } = configResolved;
359
+ const { root, build, weapp } = configResolved;
347
360
  const entries = await getEntries({
348
361
  root,
349
- outDir: build2.outDir,
362
+ outDir: build.outDir,
350
363
  srcRoot: weapp?.srcRoot,
351
364
  subPackage: weapp?.subPackage
352
365
  });
@@ -391,7 +404,7 @@ function vitePluginWeapp(ctx) {
391
404
  }
392
405
  },
393
406
  async buildStart() {
394
- const { root, build: build2, weapp } = configResolved;
407
+ const { root, build, weapp } = configResolved;
395
408
  let cwd = root;
396
409
  const ignore = [
397
410
  ...defaultExcluded
@@ -407,7 +420,7 @@ function vitePluginWeapp(ctx) {
407
420
  }) : [];
408
421
  ignore.push(
409
422
  ...[
410
- `${build2.outDir}/**`,
423
+ `${build.outDir}/**`,
411
424
  ...ignoreSubPackage,
412
425
  "project.config.json",
413
426
  "project.private.config.json",
@@ -510,6 +523,7 @@ function vitePluginWeapp(ctx) {
510
523
  }
511
524
 
512
525
  // src/symbols.ts
526
+ init_esm_shims();
513
527
  var RootRollupSymbol = Symbol("root-rollup");
514
528
  var DevSymbol = Symbol("dev");
515
529
 
@@ -555,6 +569,7 @@ async function getDefaultConfig(ctx) {
555
569
  }
556
570
  async function runDev(ctx, options) {
557
571
  process2.env.NODE_ENV = "development";
572
+ const { build } = await import("vite");
558
573
  async function innerDev() {
559
574
  const rollupWatcher = await build(
560
575
  defu3(
@@ -579,7 +594,7 @@ async function runDev(ctx, options) {
579
594
  if (options?.weapp?.subPackage) {
580
595
  return await innerDev();
581
596
  } else {
582
- const { watch } = await import("./chokidar-QBV6VO72.js");
597
+ const { watch } = await import("./chokidar-D7MR2KRX.mjs");
583
598
  const watcher = watch(["**/*.{wxml,json,wxs}", "**/*.{png,jpg,jpeg,gif,svg,webp}"], {
584
599
  ignored: [
585
600
  ...defaultExcluded,
@@ -600,6 +615,7 @@ async function runDev(ctx, options) {
600
615
  }
601
616
  }
602
617
  async function runProd(ctx, options) {
618
+ const { build } = await import("vite");
603
619
  const output = await build(
604
620
  defu3(
605
621
  options,
package/dist/cli.cjs CHANGED
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __esm = (fn, res) => function __init() {
9
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
+ };
8
11
  var __commonJS = (cb, mod) => function __require() {
9
12
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
13
  };
@@ -25,10 +28,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
28
  mod
26
29
  ));
27
30
 
31
+ // ../../node_modules/.pnpm/tsup@8.2.4_jiti@1.21.6_postcss@8.4.41_tsx@4.17.0_typescript@5.5.4_yaml@2.5.0/node_modules/tsup/assets/cjs_shims.js
32
+ var init_cjs_shims = __esm({
33
+ "../../node_modules/.pnpm/tsup@8.2.4_jiti@1.21.6_postcss@8.4.41_tsx@4.17.0_typescript@5.5.4_yaml@2.5.0/node_modules/tsup/assets/cjs_shims.js"() {
34
+ "use strict";
35
+ }
36
+ });
37
+
28
38
  // ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js
29
39
  var require_constants = __commonJS({
30
40
  "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js"(exports2, module2) {
31
41
  "use strict";
42
+ init_cjs_shims();
32
43
  var path7 = require("path");
33
44
  var WIN_SLASH = "\\\\/";
34
45
  var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
@@ -226,6 +237,7 @@ var require_constants = __commonJS({
226
237
  var require_utils = __commonJS({
227
238
  "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js"(exports2) {
228
239
  "use strict";
240
+ init_cjs_shims();
229
241
  var path7 = require("path");
230
242
  var win32 = process.platform === "win32";
231
243
  var {
@@ -287,6 +299,7 @@ var require_utils = __commonJS({
287
299
  var require_scan = __commonJS({
288
300
  "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/scan.js"(exports2, module2) {
289
301
  "use strict";
302
+ init_cjs_shims();
290
303
  var utils = require_utils();
291
304
  var {
292
305
  CHAR_ASTERISK,
@@ -617,6 +630,7 @@ var require_scan = __commonJS({
617
630
  var require_parse = __commonJS({
618
631
  "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/parse.js"(exports2, module2) {
619
632
  "use strict";
633
+ init_cjs_shims();
620
634
  var constants = require_constants();
621
635
  var utils = require_utils();
622
636
  var {
@@ -1390,6 +1404,7 @@ var require_parse = __commonJS({
1390
1404
  var require_picomatch = __commonJS({
1391
1405
  "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
1392
1406
  "use strict";
1407
+ init_cjs_shims();
1393
1408
  var path7 = require("path");
1394
1409
  var scan = require_scan();
1395
1410
  var parse2 = require_parse();
@@ -1531,6 +1546,7 @@ var require_picomatch = __commonJS({
1531
1546
  var require_picomatch2 = __commonJS({
1532
1547
  "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/index.js"(exports2, module2) {
1533
1548
  "use strict";
1549
+ init_cjs_shims();
1534
1550
  module2.exports = require_picomatch();
1535
1551
  }
1536
1552
  });
@@ -1539,6 +1555,7 @@ var require_picomatch2 = __commonJS({
1539
1555
  var require_readdirp = __commonJS({
1540
1556
  "../../node_modules/.pnpm/readdirp@3.6.0/node_modules/readdirp/index.js"(exports2, module2) {
1541
1557
  "use strict";
1558
+ init_cjs_shims();
1542
1559
  var fs4 = require("fs");
1543
1560
  var { Readable } = require("stream");
1544
1561
  var sysPath = require("path");
@@ -1769,6 +1786,7 @@ var require_readdirp = __commonJS({
1769
1786
  var require_normalize_path = __commonJS({
1770
1787
  "../../node_modules/.pnpm/normalize-path@3.0.0/node_modules/normalize-path/index.js"(exports2, module2) {
1771
1788
  "use strict";
1789
+ init_cjs_shims();
1772
1790
  module2.exports = function(path7, stripTrailing) {
1773
1791
  if (typeof path7 !== "string") {
1774
1792
  throw new TypeError("expected path to be a string");
@@ -1797,6 +1815,7 @@ var require_normalize_path = __commonJS({
1797
1815
  var require_anymatch = __commonJS({
1798
1816
  "../../node_modules/.pnpm/anymatch@3.1.3/node_modules/anymatch/index.js"(exports2, module2) {
1799
1817
  "use strict";
1818
+ init_cjs_shims();
1800
1819
  Object.defineProperty(exports2, "__esModule", { value: true });
1801
1820
  var picomatch = require_picomatch2();
1802
1821
  var normalizePath = require_normalize_path();
@@ -1864,6 +1883,7 @@ var require_anymatch = __commonJS({
1864
1883
  var require_is_extglob = __commonJS({
1865
1884
  "../../node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js"(exports2, module2) {
1866
1885
  "use strict";
1886
+ init_cjs_shims();
1867
1887
  module2.exports = function isExtglob(str) {
1868
1888
  if (typeof str !== "string" || str === "") {
1869
1889
  return false;
@@ -1882,6 +1902,7 @@ var require_is_extglob = __commonJS({
1882
1902
  var require_is_glob = __commonJS({
1883
1903
  "../../node_modules/.pnpm/is-glob@4.0.3/node_modules/is-glob/index.js"(exports2, module2) {
1884
1904
  "use strict";
1905
+ init_cjs_shims();
1885
1906
  var isExtglob = require_is_extglob();
1886
1907
  var chars = { "{": "}", "(": ")", "[": "]" };
1887
1908
  var strictCheck = function(str) {
@@ -2014,6 +2035,7 @@ var require_is_glob = __commonJS({
2014
2035
  var require_glob_parent = __commonJS({
2015
2036
  "../../node_modules/.pnpm/glob-parent@5.1.2/node_modules/glob-parent/index.js"(exports2, module2) {
2016
2037
  "use strict";
2038
+ init_cjs_shims();
2017
2039
  var isGlob = require_is_glob();
2018
2040
  var pathPosixDirname = require("path").posix.dirname;
2019
2041
  var isWin32 = require("os").platform() === "win32";
@@ -2043,6 +2065,7 @@ var require_glob_parent = __commonJS({
2043
2065
  var require_utils2 = __commonJS({
2044
2066
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js"(exports2) {
2045
2067
  "use strict";
2068
+ init_cjs_shims();
2046
2069
  exports2.isInteger = (num) => {
2047
2070
  if (typeof num === "number") {
2048
2071
  return Number.isInteger(num);
@@ -2125,6 +2148,7 @@ var require_utils2 = __commonJS({
2125
2148
  var require_stringify = __commonJS({
2126
2149
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js"(exports2, module2) {
2127
2150
  "use strict";
2151
+ init_cjs_shims();
2128
2152
  var utils = require_utils2();
2129
2153
  module2.exports = (ast, options = {}) => {
2130
2154
  const stringify = (node, parent = {}) => {
@@ -2156,6 +2180,7 @@ var require_stringify = __commonJS({
2156
2180
  var require_is_number = __commonJS({
2157
2181
  "../../node_modules/.pnpm/is-number@7.0.0/node_modules/is-number/index.js"(exports2, module2) {
2158
2182
  "use strict";
2183
+ init_cjs_shims();
2159
2184
  module2.exports = function(num) {
2160
2185
  if (typeof num === "number") {
2161
2186
  return num - num === 0;
@@ -2172,6 +2197,7 @@ var require_is_number = __commonJS({
2172
2197
  var require_to_regex_range = __commonJS({
2173
2198
  "../../node_modules/.pnpm/to-regex-range@5.0.1/node_modules/to-regex-range/index.js"(exports2, module2) {
2174
2199
  "use strict";
2200
+ init_cjs_shims();
2175
2201
  var isNumber = require_is_number();
2176
2202
  var toRegexRange = (min, max, options) => {
2177
2203
  if (isNumber(min) === false) {
@@ -2383,6 +2409,7 @@ var require_to_regex_range = __commonJS({
2383
2409
  var require_fill_range = __commonJS({
2384
2410
  "../../node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js"(exports2, module2) {
2385
2411
  "use strict";
2412
+ init_cjs_shims();
2386
2413
  var util = require("util");
2387
2414
  var toRegexRange = require_to_regex_range();
2388
2415
  var isObject2 = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
@@ -2577,6 +2604,7 @@ var require_fill_range = __commonJS({
2577
2604
  var require_compile = __commonJS({
2578
2605
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/compile.js"(exports2, module2) {
2579
2606
  "use strict";
2607
+ init_cjs_shims();
2580
2608
  var fill = require_fill_range();
2581
2609
  var utils = require_utils2();
2582
2610
  var compile = (ast, options = {}) => {
@@ -2629,6 +2657,7 @@ var require_compile = __commonJS({
2629
2657
  var require_expand = __commonJS({
2630
2658
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/expand.js"(exports2, module2) {
2631
2659
  "use strict";
2660
+ init_cjs_shims();
2632
2661
  var fill = require_fill_range();
2633
2662
  var stringify = require_stringify();
2634
2663
  var utils = require_utils2();
@@ -2723,6 +2752,7 @@ var require_expand = __commonJS({
2723
2752
  var require_constants2 = __commonJS({
2724
2753
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/constants.js"(exports2, module2) {
2725
2754
  "use strict";
2755
+ init_cjs_shims();
2726
2756
  module2.exports = {
2727
2757
  MAX_LENGTH: 1e4,
2728
2758
  // Digits
@@ -2824,6 +2854,7 @@ var require_constants2 = __commonJS({
2824
2854
  var require_parse2 = __commonJS({
2825
2855
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js"(exports2, module2) {
2826
2856
  "use strict";
2857
+ init_cjs_shims();
2827
2858
  var stringify = require_stringify();
2828
2859
  var {
2829
2860
  MAX_LENGTH,
@@ -3062,6 +3093,7 @@ var require_parse2 = __commonJS({
3062
3093
  var require_braces = __commonJS({
3063
3094
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/index.js"(exports2, module2) {
3064
3095
  "use strict";
3096
+ init_cjs_shims();
3065
3097
  var stringify = require_stringify();
3066
3098
  var compile = require_compile();
3067
3099
  var expand = require_expand();
@@ -3394,6 +3426,7 @@ var require_binary_extensions = __commonJS({
3394
3426
  var require_binary_extensions2 = __commonJS({
3395
3427
  "../../node_modules/.pnpm/binary-extensions@2.3.0/node_modules/binary-extensions/index.js"(exports2, module2) {
3396
3428
  "use strict";
3429
+ init_cjs_shims();
3397
3430
  module2.exports = require_binary_extensions();
3398
3431
  }
3399
3432
  });
@@ -3402,6 +3435,7 @@ var require_binary_extensions2 = __commonJS({
3402
3435
  var require_is_binary_path = __commonJS({
3403
3436
  "../../node_modules/.pnpm/is-binary-path@2.1.0/node_modules/is-binary-path/index.js"(exports2, module2) {
3404
3437
  "use strict";
3438
+ init_cjs_shims();
3405
3439
  var path7 = require("path");
3406
3440
  var binaryExtensions = require_binary_extensions2();
3407
3441
  var extensions = new Set(binaryExtensions);
@@ -3413,6 +3447,7 @@ var require_is_binary_path = __commonJS({
3413
3447
  var require_constants3 = __commonJS({
3414
3448
  "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/constants.js"(exports2) {
3415
3449
  "use strict";
3450
+ init_cjs_shims();
3416
3451
  var { sep } = require("path");
3417
3452
  var { platform } = process;
3418
3453
  var os = require("os");
@@ -3477,6 +3512,7 @@ var require_constants3 = __commonJS({
3477
3512
  var require_nodefs_handler = __commonJS({
3478
3513
  "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/nodefs-handler.js"(exports2, module2) {
3479
3514
  "use strict";
3515
+ init_cjs_shims();
3480
3516
  var fs4 = require("fs");
3481
3517
  var sysPath = require("path");
3482
3518
  var { promisify } = require("util");
@@ -3968,6 +4004,7 @@ var require_nodefs_handler = __commonJS({
3968
4004
  var require_fsevents_handler = __commonJS({
3969
4005
  "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/fsevents-handler.js"(exports2, module2) {
3970
4006
  "use strict";
4007
+ init_cjs_shims();
3971
4008
  var fs4 = require("fs");
3972
4009
  var sysPath = require("path");
3973
4010
  var { promisify } = require("util");
@@ -4364,6 +4401,7 @@ var require_fsevents_handler = __commonJS({
4364
4401
  var require_chokidar = __commonJS({
4365
4402
  "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/index.js"(exports2) {
4366
4403
  "use strict";
4404
+ init_cjs_shims();
4367
4405
  var { EventEmitter } = require("events");
4368
4406
  var fs4 = require("fs");
4369
4407
  var sysPath = require("path");
@@ -5106,30 +5144,36 @@ var require_chokidar = __commonJS({
5106
5144
  });
5107
5145
 
5108
5146
  // src/cli.ts
5109
- var import_node_process4 = __toESM(require("process"), 1);
5147
+ init_cjs_shims();
5148
+ var import_node_process4 = __toESM(require("process"));
5110
5149
  var import_commander = require("commander");
5111
5150
  var import_init = require("@weapp-core/init");
5112
5151
  var import_weapp_ide_cli = require("weapp-ide-cli");
5113
5152
 
5114
5153
  // src/build.ts
5115
- var import_node_process2 = __toESM(require("process"), 1);
5116
- var import_vite2 = require("vite");
5154
+ init_cjs_shims();
5155
+ var import_node_process2 = __toESM(require("process"));
5117
5156
  var import_shared4 = require("@weapp-core/shared");
5118
5157
  var import_pkg_types = require("pkg-types");
5119
- var import_pathe5 = __toESM(require("pathe"), 1);
5120
- var import_vite_tsconfig_paths = __toESM(require("vite-tsconfig-paths"), 1);
5158
+ var import_pathe5 = __toESM(require("pathe"));
5159
+ var import_vite_tsconfig_paths = __toESM(require("vite-tsconfig-paths"));
5121
5160
 
5122
5161
  // src/plugins/index.ts
5123
- var import_pathe4 = __toESM(require("pathe"), 1);
5124
- var import_fs_extra3 = __toESM(require("fs-extra"), 1);
5125
- var import_magic_string = __toESM(require("magic-string"), 1);
5162
+ init_cjs_shims();
5163
+ var import_pathe4 = __toESM(require("pathe"));
5164
+ var import_fs_extra3 = __toESM(require("fs-extra"));
5165
+ var import_magic_string = __toESM(require("magic-string"));
5126
5166
  var import_shared3 = require("@weapp-core/shared");
5127
5167
  var import_vite = require("vite");
5128
- var import_fast_glob = __toESM(require("fast-glob"), 1);
5168
+ var import_fast_glob = __toESM(require("fast-glob"));
5169
+
5170
+ // src/utils/index.ts
5171
+ init_cjs_shims();
5129
5172
 
5130
5173
  // src/utils/scan.ts
5131
- var import_pathe = __toESM(require("pathe"), 1);
5132
- var import_fs_extra = __toESM(require("fs-extra"), 1);
5174
+ init_cjs_shims();
5175
+ var import_pathe = __toESM(require("pathe"));
5176
+ var import_fs_extra = __toESM(require("fs-extra"));
5133
5177
  var import_shared = require("@weapp-core/shared");
5134
5178
  var defaultExcluded = ["**/node_modules/**", "**/miniprogram_npm/**"];
5135
5179
  function searchAppEntry(options) {
@@ -5236,8 +5280,9 @@ function getWxmlEntry(wxmlPath, formatPath) {
5236
5280
  }
5237
5281
 
5238
5282
  // src/utils/projectConfig.ts
5239
- var import_pathe2 = __toESM(require("pathe"), 1);
5240
- var import_fs_extra2 = __toESM(require("fs-extra"), 1);
5283
+ init_cjs_shims();
5284
+ var import_pathe2 = __toESM(require("pathe"));
5285
+ var import_fs_extra2 = __toESM(require("fs-extra"));
5241
5286
  function getProjectConfig(root, options) {
5242
5287
  const baseJsonPath = import_pathe2.default.resolve(root, "project.config.json");
5243
5288
  const privateJsonPath = import_pathe2.default.resolve(root, "project.private.config.json");
@@ -5269,11 +5314,12 @@ var supportedCssLangs = ["wxss", "scss", "less", "sass", "styl"];
5269
5314
  var supportedCssExtensions = supportedCssLangs.map((x) => `.${x}`);
5270
5315
 
5271
5316
  // src/entry.ts
5272
- var import_node_process = __toESM(require("process"), 1);
5273
- var import_micromatch = __toESM(require("micromatch"), 1);
5317
+ init_cjs_shims();
5318
+ var import_node_process = __toESM(require("process"));
5319
+ var import_micromatch = __toESM(require("micromatch"));
5274
5320
  var import_shared2 = require("@weapp-core/shared");
5275
- var import_pathe3 = __toESM(require("pathe"), 1);
5276
- var import_klaw = __toESM(require("klaw"), 1);
5321
+ var import_pathe3 = __toESM(require("pathe"));
5322
+ var import_klaw = __toESM(require("klaw"));
5277
5323
  function createFilter(include, exclude, options) {
5278
5324
  const opts = (0, import_shared2.defu)(options, {
5279
5325
  ignore: exclude
@@ -5393,7 +5439,8 @@ async function getEntries(options) {
5393
5439
  }
5394
5440
 
5395
5441
  // src/debugger.ts
5396
- var import_debug = __toESM(require("debug"), 1);
5442
+ init_cjs_shims();
5443
+ var import_debug = __toESM(require("debug"));
5397
5444
  function createDebugger(namespace) {
5398
5445
  const debug2 = (0, import_debug.default)(namespace);
5399
5446
  if (debug2.enabled) {
@@ -5402,6 +5449,7 @@ function createDebugger(namespace) {
5402
5449
  }
5403
5450
 
5404
5451
  // src/plugins/parse.ts
5452
+ init_cjs_shims();
5405
5453
  function parseRequest(id) {
5406
5454
  const [filename, rawQuery] = id.split(`?`, 2);
5407
5455
  const query = Object.fromEntries(new URLSearchParams(rawQuery));
@@ -5456,10 +5504,10 @@ function vitePluginWeapp(ctx) {
5456
5504
  configResolved = config;
5457
5505
  },
5458
5506
  async options(options) {
5459
- const { root, build: build2, weapp } = configResolved;
5507
+ const { root, build, weapp } = configResolved;
5460
5508
  const entries = await getEntries({
5461
5509
  root,
5462
- outDir: build2.outDir,
5510
+ outDir: build.outDir,
5463
5511
  srcRoot: weapp?.srcRoot,
5464
5512
  subPackage: weapp?.subPackage
5465
5513
  });
@@ -5504,7 +5552,7 @@ function vitePluginWeapp(ctx) {
5504
5552
  }
5505
5553
  },
5506
5554
  async buildStart() {
5507
- const { root, build: build2, weapp } = configResolved;
5555
+ const { root, build, weapp } = configResolved;
5508
5556
  let cwd = root;
5509
5557
  const ignore = [
5510
5558
  ...defaultExcluded
@@ -5520,7 +5568,7 @@ function vitePluginWeapp(ctx) {
5520
5568
  }) : [];
5521
5569
  ignore.push(
5522
5570
  ...[
5523
- `${build2.outDir}/**`,
5571
+ `${build.outDir}/**`,
5524
5572
  ...ignoreSubPackage,
5525
5573
  "project.config.json",
5526
5574
  "project.private.config.json",
@@ -5623,6 +5671,7 @@ function vitePluginWeapp(ctx) {
5623
5671
  }
5624
5672
 
5625
5673
  // src/symbols.ts
5674
+ init_cjs_shims();
5626
5675
  var RootRollupSymbol = Symbol("root-rollup");
5627
5676
  var DevSymbol = Symbol("dev");
5628
5677
 
@@ -5668,8 +5717,9 @@ async function getDefaultConfig(ctx) {
5668
5717
  }
5669
5718
  async function runDev(ctx, options) {
5670
5719
  import_node_process2.default.env.NODE_ENV = "development";
5720
+ const { build } = await import("vite");
5671
5721
  async function innerDev() {
5672
- const rollupWatcher = await (0, import_vite2.build)(
5722
+ const rollupWatcher = await build(
5673
5723
  (0, import_shared4.defu)(
5674
5724
  options,
5675
5725
  await getDefaultConfig(ctx),
@@ -5692,7 +5742,7 @@ async function runDev(ctx, options) {
5692
5742
  if (options?.weapp?.subPackage) {
5693
5743
  return await innerDev();
5694
5744
  } else {
5695
- const { watch } = await Promise.resolve().then(() => __toESM(require_chokidar(), 1));
5745
+ const { watch } = await Promise.resolve().then(() => __toESM(require_chokidar()));
5696
5746
  const watcher = watch(["**/*.{wxml,json,wxs}", "**/*.{png,jpg,jpeg,gif,svg,webp}"], {
5697
5747
  ignored: [
5698
5748
  ...defaultExcluded,
@@ -5713,7 +5763,8 @@ async function runDev(ctx, options) {
5713
5763
  }
5714
5764
  }
5715
5765
  async function runProd(ctx, options) {
5716
- const output = await (0, import_vite2.build)(
5766
+ const { build } = await import("vite");
5767
+ const output = await build(
5717
5768
  (0, import_shared4.defu)(
5718
5769
  options,
5719
5770
  await getDefaultConfig(ctx),
@@ -5726,12 +5777,14 @@ async function runProd(ctx, options) {
5726
5777
  }
5727
5778
 
5728
5779
  // src/logger.ts
5729
- var import_logger = __toESM(require("@weapp-core/logger"), 1);
5780
+ init_cjs_shims();
5781
+ var import_logger = __toESM(require("@weapp-core/logger"));
5730
5782
  var logger_default = import_logger.default;
5731
5783
 
5732
5784
  // src/context.ts
5733
- var import_node_process3 = __toESM(require("process"), 1);
5734
- var import_pathe6 = __toESM(require("pathe"), 1);
5785
+ init_cjs_shims();
5786
+ var import_node_process3 = __toESM(require("process"));
5787
+ var import_pathe6 = __toESM(require("pathe"));
5735
5788
  function createContext(cwd = import_node_process3.default.cwd()) {
5736
5789
  const watcherCache = /* @__PURE__ */ new Map();
5737
5790
  const assetCache = /* @__PURE__ */ new Map();
@@ -2,20 +2,25 @@ import {
2
2
  getProjectConfig,
3
3
  runDev,
4
4
  runProd
5
- } from "./chunk-C24QMDAC.js";
6
- import "./chunk-MCKGQKYU.js";
5
+ } from "./chunk-U2PI5Z6J.mjs";
6
+ import {
7
+ init_esm_shims
8
+ } from "./chunk-3276ZVN4.mjs";
7
9
 
8
10
  // src/cli.ts
11
+ init_esm_shims();
9
12
  import process2 from "node:process";
10
13
  import { program } from "commander";
11
14
  import { initConfig } from "@weapp-core/init";
12
15
  import { parse } from "weapp-ide-cli";
13
16
 
14
17
  // src/logger.ts
18
+ init_esm_shims();
15
19
  import logger from "@weapp-core/logger";
16
20
  var logger_default = logger;
17
21
 
18
22
  // src/context.ts
23
+ init_esm_shims();
19
24
  import process from "node:process";
20
25
  import path from "pathe";
21
26
  function createContext(cwd = process.cwd()) {
@@ -1,6 +1,6 @@
1
1
  import { UserConfig, UserConfigFnObject, UserConfigExport } from 'vite';
2
2
  export { UserConfig, UserConfigExport, UserConfigFnObject } from 'vite';
3
- import { W as WeappViteConfig } from './types-zERbFVBd.cjs';
3
+ import { W as WeappViteConfig } from './types-zERbFVBd.mjs';
4
4
 
5
5
  declare module 'vite' {
6
6
  interface UserConfig {
@@ -1,6 +1,9 @@
1
- import "./chunk-MCKGQKYU.js";
1
+ import {
2
+ init_esm_shims
3
+ } from "./chunk-3276ZVN4.mjs";
2
4
 
3
5
  // src/config.ts
6
+ init_esm_shims();
4
7
  function defineConfig(config) {
5
8
  return config;
6
9
  }
package/dist/index.cjs CHANGED
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __esm = (fn, res) => function __init() {
9
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
+ };
8
11
  var __commonJS = (cb, mod) => function __require() {
9
12
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
13
  };
@@ -30,10 +33,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
33
  ));
31
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
35
 
36
+ // ../../node_modules/.pnpm/tsup@8.2.4_jiti@1.21.6_postcss@8.4.41_tsx@4.17.0_typescript@5.5.4_yaml@2.5.0/node_modules/tsup/assets/cjs_shims.js
37
+ var init_cjs_shims = __esm({
38
+ "../../node_modules/.pnpm/tsup@8.2.4_jiti@1.21.6_postcss@8.4.41_tsx@4.17.0_typescript@5.5.4_yaml@2.5.0/node_modules/tsup/assets/cjs_shims.js"() {
39
+ "use strict";
40
+ }
41
+ });
42
+
33
43
  // ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js
34
44
  var require_constants = __commonJS({
35
45
  "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js"(exports2, module2) {
36
46
  "use strict";
47
+ init_cjs_shims();
37
48
  var path6 = require("path");
38
49
  var WIN_SLASH = "\\\\/";
39
50
  var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
@@ -231,6 +242,7 @@ var require_constants = __commonJS({
231
242
  var require_utils = __commonJS({
232
243
  "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js"(exports2) {
233
244
  "use strict";
245
+ init_cjs_shims();
234
246
  var path6 = require("path");
235
247
  var win32 = process.platform === "win32";
236
248
  var {
@@ -292,6 +304,7 @@ var require_utils = __commonJS({
292
304
  var require_scan = __commonJS({
293
305
  "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/scan.js"(exports2, module2) {
294
306
  "use strict";
307
+ init_cjs_shims();
295
308
  var utils = require_utils();
296
309
  var {
297
310
  CHAR_ASTERISK,
@@ -622,6 +635,7 @@ var require_scan = __commonJS({
622
635
  var require_parse = __commonJS({
623
636
  "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/parse.js"(exports2, module2) {
624
637
  "use strict";
638
+ init_cjs_shims();
625
639
  var constants = require_constants();
626
640
  var utils = require_utils();
627
641
  var {
@@ -1395,6 +1409,7 @@ var require_parse = __commonJS({
1395
1409
  var require_picomatch = __commonJS({
1396
1410
  "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
1397
1411
  "use strict";
1412
+ init_cjs_shims();
1398
1413
  var path6 = require("path");
1399
1414
  var scan = require_scan();
1400
1415
  var parse = require_parse();
@@ -1536,6 +1551,7 @@ var require_picomatch = __commonJS({
1536
1551
  var require_picomatch2 = __commonJS({
1537
1552
  "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/index.js"(exports2, module2) {
1538
1553
  "use strict";
1554
+ init_cjs_shims();
1539
1555
  module2.exports = require_picomatch();
1540
1556
  }
1541
1557
  });
@@ -1544,6 +1560,7 @@ var require_picomatch2 = __commonJS({
1544
1560
  var require_readdirp = __commonJS({
1545
1561
  "../../node_modules/.pnpm/readdirp@3.6.0/node_modules/readdirp/index.js"(exports2, module2) {
1546
1562
  "use strict";
1563
+ init_cjs_shims();
1547
1564
  var fs4 = require("fs");
1548
1565
  var { Readable } = require("stream");
1549
1566
  var sysPath = require("path");
@@ -1774,6 +1791,7 @@ var require_readdirp = __commonJS({
1774
1791
  var require_normalize_path = __commonJS({
1775
1792
  "../../node_modules/.pnpm/normalize-path@3.0.0/node_modules/normalize-path/index.js"(exports2, module2) {
1776
1793
  "use strict";
1794
+ init_cjs_shims();
1777
1795
  module2.exports = function(path6, stripTrailing) {
1778
1796
  if (typeof path6 !== "string") {
1779
1797
  throw new TypeError("expected path to be a string");
@@ -1802,6 +1820,7 @@ var require_normalize_path = __commonJS({
1802
1820
  var require_anymatch = __commonJS({
1803
1821
  "../../node_modules/.pnpm/anymatch@3.1.3/node_modules/anymatch/index.js"(exports2, module2) {
1804
1822
  "use strict";
1823
+ init_cjs_shims();
1805
1824
  Object.defineProperty(exports2, "__esModule", { value: true });
1806
1825
  var picomatch = require_picomatch2();
1807
1826
  var normalizePath = require_normalize_path();
@@ -1869,6 +1888,7 @@ var require_anymatch = __commonJS({
1869
1888
  var require_is_extglob = __commonJS({
1870
1889
  "../../node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js"(exports2, module2) {
1871
1890
  "use strict";
1891
+ init_cjs_shims();
1872
1892
  module2.exports = function isExtglob(str) {
1873
1893
  if (typeof str !== "string" || str === "") {
1874
1894
  return false;
@@ -1887,6 +1907,7 @@ var require_is_extglob = __commonJS({
1887
1907
  var require_is_glob = __commonJS({
1888
1908
  "../../node_modules/.pnpm/is-glob@4.0.3/node_modules/is-glob/index.js"(exports2, module2) {
1889
1909
  "use strict";
1910
+ init_cjs_shims();
1890
1911
  var isExtglob = require_is_extglob();
1891
1912
  var chars = { "{": "}", "(": ")", "[": "]" };
1892
1913
  var strictCheck = function(str) {
@@ -2019,6 +2040,7 @@ var require_is_glob = __commonJS({
2019
2040
  var require_glob_parent = __commonJS({
2020
2041
  "../../node_modules/.pnpm/glob-parent@5.1.2/node_modules/glob-parent/index.js"(exports2, module2) {
2021
2042
  "use strict";
2043
+ init_cjs_shims();
2022
2044
  var isGlob = require_is_glob();
2023
2045
  var pathPosixDirname = require("path").posix.dirname;
2024
2046
  var isWin32 = require("os").platform() === "win32";
@@ -2048,6 +2070,7 @@ var require_glob_parent = __commonJS({
2048
2070
  var require_utils2 = __commonJS({
2049
2071
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js"(exports2) {
2050
2072
  "use strict";
2073
+ init_cjs_shims();
2051
2074
  exports2.isInteger = (num) => {
2052
2075
  if (typeof num === "number") {
2053
2076
  return Number.isInteger(num);
@@ -2130,6 +2153,7 @@ var require_utils2 = __commonJS({
2130
2153
  var require_stringify = __commonJS({
2131
2154
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js"(exports2, module2) {
2132
2155
  "use strict";
2156
+ init_cjs_shims();
2133
2157
  var utils = require_utils2();
2134
2158
  module2.exports = (ast, options = {}) => {
2135
2159
  const stringify = (node, parent = {}) => {
@@ -2161,6 +2185,7 @@ var require_stringify = __commonJS({
2161
2185
  var require_is_number = __commonJS({
2162
2186
  "../../node_modules/.pnpm/is-number@7.0.0/node_modules/is-number/index.js"(exports2, module2) {
2163
2187
  "use strict";
2188
+ init_cjs_shims();
2164
2189
  module2.exports = function(num) {
2165
2190
  if (typeof num === "number") {
2166
2191
  return num - num === 0;
@@ -2177,6 +2202,7 @@ var require_is_number = __commonJS({
2177
2202
  var require_to_regex_range = __commonJS({
2178
2203
  "../../node_modules/.pnpm/to-regex-range@5.0.1/node_modules/to-regex-range/index.js"(exports2, module2) {
2179
2204
  "use strict";
2205
+ init_cjs_shims();
2180
2206
  var isNumber = require_is_number();
2181
2207
  var toRegexRange = (min, max, options) => {
2182
2208
  if (isNumber(min) === false) {
@@ -2388,6 +2414,7 @@ var require_to_regex_range = __commonJS({
2388
2414
  var require_fill_range = __commonJS({
2389
2415
  "../../node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js"(exports2, module2) {
2390
2416
  "use strict";
2417
+ init_cjs_shims();
2391
2418
  var util = require("util");
2392
2419
  var toRegexRange = require_to_regex_range();
2393
2420
  var isObject2 = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
@@ -2582,6 +2609,7 @@ var require_fill_range = __commonJS({
2582
2609
  var require_compile = __commonJS({
2583
2610
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/compile.js"(exports2, module2) {
2584
2611
  "use strict";
2612
+ init_cjs_shims();
2585
2613
  var fill = require_fill_range();
2586
2614
  var utils = require_utils2();
2587
2615
  var compile = (ast, options = {}) => {
@@ -2634,6 +2662,7 @@ var require_compile = __commonJS({
2634
2662
  var require_expand = __commonJS({
2635
2663
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/expand.js"(exports2, module2) {
2636
2664
  "use strict";
2665
+ init_cjs_shims();
2637
2666
  var fill = require_fill_range();
2638
2667
  var stringify = require_stringify();
2639
2668
  var utils = require_utils2();
@@ -2728,6 +2757,7 @@ var require_expand = __commonJS({
2728
2757
  var require_constants2 = __commonJS({
2729
2758
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/constants.js"(exports2, module2) {
2730
2759
  "use strict";
2760
+ init_cjs_shims();
2731
2761
  module2.exports = {
2732
2762
  MAX_LENGTH: 1e4,
2733
2763
  // Digits
@@ -2829,6 +2859,7 @@ var require_constants2 = __commonJS({
2829
2859
  var require_parse2 = __commonJS({
2830
2860
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js"(exports2, module2) {
2831
2861
  "use strict";
2862
+ init_cjs_shims();
2832
2863
  var stringify = require_stringify();
2833
2864
  var {
2834
2865
  MAX_LENGTH,
@@ -3067,6 +3098,7 @@ var require_parse2 = __commonJS({
3067
3098
  var require_braces = __commonJS({
3068
3099
  "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/index.js"(exports2, module2) {
3069
3100
  "use strict";
3101
+ init_cjs_shims();
3070
3102
  var stringify = require_stringify();
3071
3103
  var compile = require_compile();
3072
3104
  var expand = require_expand();
@@ -3399,6 +3431,7 @@ var require_binary_extensions = __commonJS({
3399
3431
  var require_binary_extensions2 = __commonJS({
3400
3432
  "../../node_modules/.pnpm/binary-extensions@2.3.0/node_modules/binary-extensions/index.js"(exports2, module2) {
3401
3433
  "use strict";
3434
+ init_cjs_shims();
3402
3435
  module2.exports = require_binary_extensions();
3403
3436
  }
3404
3437
  });
@@ -3407,6 +3440,7 @@ var require_binary_extensions2 = __commonJS({
3407
3440
  var require_is_binary_path = __commonJS({
3408
3441
  "../../node_modules/.pnpm/is-binary-path@2.1.0/node_modules/is-binary-path/index.js"(exports2, module2) {
3409
3442
  "use strict";
3443
+ init_cjs_shims();
3410
3444
  var path6 = require("path");
3411
3445
  var binaryExtensions = require_binary_extensions2();
3412
3446
  var extensions = new Set(binaryExtensions);
@@ -3418,6 +3452,7 @@ var require_is_binary_path = __commonJS({
3418
3452
  var require_constants3 = __commonJS({
3419
3453
  "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/constants.js"(exports2) {
3420
3454
  "use strict";
3455
+ init_cjs_shims();
3421
3456
  var { sep } = require("path");
3422
3457
  var { platform } = process;
3423
3458
  var os = require("os");
@@ -3482,6 +3517,7 @@ var require_constants3 = __commonJS({
3482
3517
  var require_nodefs_handler = __commonJS({
3483
3518
  "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/nodefs-handler.js"(exports2, module2) {
3484
3519
  "use strict";
3520
+ init_cjs_shims();
3485
3521
  var fs4 = require("fs");
3486
3522
  var sysPath = require("path");
3487
3523
  var { promisify } = require("util");
@@ -3973,6 +4009,7 @@ var require_nodefs_handler = __commonJS({
3973
4009
  var require_fsevents_handler = __commonJS({
3974
4010
  "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/fsevents-handler.js"(exports2, module2) {
3975
4011
  "use strict";
4012
+ init_cjs_shims();
3976
4013
  var fs4 = require("fs");
3977
4014
  var sysPath = require("path");
3978
4015
  var { promisify } = require("util");
@@ -4369,6 +4406,7 @@ var require_fsevents_handler = __commonJS({
4369
4406
  var require_chokidar = __commonJS({
4370
4407
  "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/index.js"(exports2) {
4371
4408
  "use strict";
4409
+ init_cjs_shims();
4372
4410
  var { EventEmitter } = require("events");
4373
4411
  var fs4 = require("fs");
4374
4412
  var sysPath = require("path");
@@ -5118,26 +5156,32 @@ __export(src_exports, {
5118
5156
  runProd: () => runProd
5119
5157
  });
5120
5158
  module.exports = __toCommonJS(src_exports);
5159
+ init_cjs_shims();
5121
5160
 
5122
5161
  // src/build.ts
5123
- var import_node_process2 = __toESM(require("process"), 1);
5124
- var import_vite2 = require("vite");
5162
+ init_cjs_shims();
5163
+ var import_node_process2 = __toESM(require("process"));
5125
5164
  var import_shared4 = require("@weapp-core/shared");
5126
5165
  var import_pkg_types = require("pkg-types");
5127
- var import_pathe5 = __toESM(require("pathe"), 1);
5128
- var import_vite_tsconfig_paths = __toESM(require("vite-tsconfig-paths"), 1);
5166
+ var import_pathe5 = __toESM(require("pathe"));
5167
+ var import_vite_tsconfig_paths = __toESM(require("vite-tsconfig-paths"));
5129
5168
 
5130
5169
  // src/plugins/index.ts
5131
- var import_pathe4 = __toESM(require("pathe"), 1);
5132
- var import_fs_extra3 = __toESM(require("fs-extra"), 1);
5133
- var import_magic_string = __toESM(require("magic-string"), 1);
5170
+ init_cjs_shims();
5171
+ var import_pathe4 = __toESM(require("pathe"));
5172
+ var import_fs_extra3 = __toESM(require("fs-extra"));
5173
+ var import_magic_string = __toESM(require("magic-string"));
5134
5174
  var import_shared3 = require("@weapp-core/shared");
5135
5175
  var import_vite = require("vite");
5136
- var import_fast_glob = __toESM(require("fast-glob"), 1);
5176
+ var import_fast_glob = __toESM(require("fast-glob"));
5177
+
5178
+ // src/utils/index.ts
5179
+ init_cjs_shims();
5137
5180
 
5138
5181
  // src/utils/scan.ts
5139
- var import_pathe = __toESM(require("pathe"), 1);
5140
- var import_fs_extra = __toESM(require("fs-extra"), 1);
5182
+ init_cjs_shims();
5183
+ var import_pathe = __toESM(require("pathe"));
5184
+ var import_fs_extra = __toESM(require("fs-extra"));
5141
5185
  var import_shared = require("@weapp-core/shared");
5142
5186
  var defaultExcluded = ["**/node_modules/**", "**/miniprogram_npm/**"];
5143
5187
  function searchAppEntry(options) {
@@ -5244,19 +5288,21 @@ function getWxmlEntry(wxmlPath, formatPath) {
5244
5288
  }
5245
5289
 
5246
5290
  // src/utils/projectConfig.ts
5247
- var import_pathe2 = __toESM(require("pathe"), 1);
5248
- var import_fs_extra2 = __toESM(require("fs-extra"), 1);
5291
+ init_cjs_shims();
5292
+ var import_pathe2 = __toESM(require("pathe"));
5293
+ var import_fs_extra2 = __toESM(require("fs-extra"));
5249
5294
 
5250
5295
  // src/utils/index.ts
5251
5296
  var supportedCssLangs = ["wxss", "scss", "less", "sass", "styl"];
5252
5297
  var supportedCssExtensions = supportedCssLangs.map((x) => `.${x}`);
5253
5298
 
5254
5299
  // src/entry.ts
5255
- var import_node_process = __toESM(require("process"), 1);
5256
- var import_micromatch = __toESM(require("micromatch"), 1);
5300
+ init_cjs_shims();
5301
+ var import_node_process = __toESM(require("process"));
5302
+ var import_micromatch = __toESM(require("micromatch"));
5257
5303
  var import_shared2 = require("@weapp-core/shared");
5258
- var import_pathe3 = __toESM(require("pathe"), 1);
5259
- var import_klaw = __toESM(require("klaw"), 1);
5304
+ var import_pathe3 = __toESM(require("pathe"));
5305
+ var import_klaw = __toESM(require("klaw"));
5260
5306
  function createFilter(include, exclude, options) {
5261
5307
  const opts = (0, import_shared2.defu)(options, {
5262
5308
  ignore: exclude
@@ -5376,7 +5422,8 @@ async function getEntries(options) {
5376
5422
  }
5377
5423
 
5378
5424
  // src/debugger.ts
5379
- var import_debug = __toESM(require("debug"), 1);
5425
+ init_cjs_shims();
5426
+ var import_debug = __toESM(require("debug"));
5380
5427
  function createDebugger(namespace) {
5381
5428
  const debug2 = (0, import_debug.default)(namespace);
5382
5429
  if (debug2.enabled) {
@@ -5385,6 +5432,7 @@ function createDebugger(namespace) {
5385
5432
  }
5386
5433
 
5387
5434
  // src/plugins/parse.ts
5435
+ init_cjs_shims();
5388
5436
  function parseRequest(id) {
5389
5437
  const [filename, rawQuery] = id.split(`?`, 2);
5390
5438
  const query = Object.fromEntries(new URLSearchParams(rawQuery));
@@ -5439,10 +5487,10 @@ function vitePluginWeapp(ctx) {
5439
5487
  configResolved = config;
5440
5488
  },
5441
5489
  async options(options) {
5442
- const { root, build: build2, weapp } = configResolved;
5490
+ const { root, build, weapp } = configResolved;
5443
5491
  const entries = await getEntries({
5444
5492
  root,
5445
- outDir: build2.outDir,
5493
+ outDir: build.outDir,
5446
5494
  srcRoot: weapp?.srcRoot,
5447
5495
  subPackage: weapp?.subPackage
5448
5496
  });
@@ -5487,7 +5535,7 @@ function vitePluginWeapp(ctx) {
5487
5535
  }
5488
5536
  },
5489
5537
  async buildStart() {
5490
- const { root, build: build2, weapp } = configResolved;
5538
+ const { root, build, weapp } = configResolved;
5491
5539
  let cwd = root;
5492
5540
  const ignore = [
5493
5541
  ...defaultExcluded
@@ -5503,7 +5551,7 @@ function vitePluginWeapp(ctx) {
5503
5551
  }) : [];
5504
5552
  ignore.push(
5505
5553
  ...[
5506
- `${build2.outDir}/**`,
5554
+ `${build.outDir}/**`,
5507
5555
  ...ignoreSubPackage,
5508
5556
  "project.config.json",
5509
5557
  "project.private.config.json",
@@ -5606,6 +5654,7 @@ function vitePluginWeapp(ctx) {
5606
5654
  }
5607
5655
 
5608
5656
  // src/symbols.ts
5657
+ init_cjs_shims();
5609
5658
  var RootRollupSymbol = Symbol("root-rollup");
5610
5659
  var DevSymbol = Symbol("dev");
5611
5660
 
@@ -5651,8 +5700,9 @@ async function getDefaultConfig(ctx) {
5651
5700
  }
5652
5701
  async function runDev(ctx, options) {
5653
5702
  import_node_process2.default.env.NODE_ENV = "development";
5703
+ const { build } = await import("vite");
5654
5704
  async function innerDev() {
5655
- const rollupWatcher = await (0, import_vite2.build)(
5705
+ const rollupWatcher = await build(
5656
5706
  (0, import_shared4.defu)(
5657
5707
  options,
5658
5708
  await getDefaultConfig(ctx),
@@ -5675,7 +5725,7 @@ async function runDev(ctx, options) {
5675
5725
  if (options?.weapp?.subPackage) {
5676
5726
  return await innerDev();
5677
5727
  } else {
5678
- const { watch } = await Promise.resolve().then(() => __toESM(require_chokidar(), 1));
5728
+ const { watch } = await Promise.resolve().then(() => __toESM(require_chokidar()));
5679
5729
  const watcher = watch(["**/*.{wxml,json,wxs}", "**/*.{png,jpg,jpeg,gif,svg,webp}"], {
5680
5730
  ignored: [
5681
5731
  ...defaultExcluded,
@@ -5696,7 +5746,8 @@ async function runDev(ctx, options) {
5696
5746
  }
5697
5747
  }
5698
5748
  async function runProd(ctx, options) {
5699
- const output = await (0, import_vite2.build)(
5749
+ const { build } = await import("vite");
5750
+ const output = await build(
5700
5751
  (0, import_shared4.defu)(
5701
5752
  options,
5702
5753
  await getDefaultConfig(ctx),
@@ -1,7 +1,7 @@
1
1
  import * as chokidar from 'chokidar';
2
2
  import { FSWatcher } from 'chokidar';
3
3
  import { RollupWatcher, EmittedFile, RollupOutput } from 'rollup';
4
- import { U as UserConfig } from './types-zERbFVBd.cjs';
4
+ import { U as UserConfig } from './types-zERbFVBd.mjs';
5
5
  import 'vite';
6
6
 
7
7
  declare function createContext(cwd?: string): {
package/dist/index.mjs ADDED
@@ -0,0 +1,16 @@
1
+ import {
2
+ getDefaultConfig,
3
+ runDev,
4
+ runProd
5
+ } from "./chunk-U2PI5Z6J.mjs";
6
+ import {
7
+ init_esm_shims
8
+ } from "./chunk-3276ZVN4.mjs";
9
+
10
+ // src/index.ts
11
+ init_esm_shims();
12
+ export {
13
+ getDefaultConfig,
14
+ runDev,
15
+ runProd
16
+ };
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
- "type": "module",
4
- "version": "1.0.4",
3
+ "version": "1.0.6",
5
4
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
5
  "author": "SonOfMagic <qq1324318532@gmail.com>",
7
6
  "license": "MIT",
@@ -27,18 +26,19 @@
27
26
  "exports": {
28
27
  ".": {
29
28
  "types": "./dist/index.d.ts",
30
- "import": "./dist/index.js",
29
+ "import": "./dist/index.mjs",
31
30
  "require": "./dist/index.cjs"
32
31
  },
33
32
  "./config": {
34
33
  "types": "./dist/config.d.ts",
35
- "import": "./dist/config.js",
34
+ "import": "./dist/config.mjs",
36
35
  "require": "./dist/config.cjs"
37
36
  },
38
37
  "./package.json": "./package.json"
39
38
  },
40
39
  "bin": {
41
- "weapp-vite": "bin/weapp-vite.js"
40
+ "weapp-vite": "bin/weapp-vite.js",
41
+ "weapp-vite-esm": "bin/weapp-vite-esm.js"
42
42
  },
43
43
  "files": [
44
44
  "bin",
@@ -60,9 +60,9 @@
60
60
  "pkg-types": "^1.1.3",
61
61
  "vite-tsconfig-paths": "^5.0.1",
62
62
  "@weapp-core/init": "^1.0.2",
63
- "@weapp-core/shared": "^1.0.1",
64
63
  "@weapp-core/logger": "^1.0.1",
65
- "weapp-ide-cli": "^2.0.1"
64
+ "@weapp-core/shared": "^1.0.1",
65
+ "weapp-ide-cli": "^2.0.2"
66
66
  },
67
67
  "publishConfig": {
68
68
  "access": "public",
@@ -77,6 +77,6 @@
77
77
  "sync": "cnpm sync weapp-vite"
78
78
  },
79
79
  "main": "./dist/index.cjs",
80
- "module": "./dist/index.js",
80
+ "module": "./dist/index.mjs",
81
81
  "types": "./dist/index.d.ts"
82
82
  }
package/dist/index.js DELETED
@@ -1,11 +0,0 @@
1
- import {
2
- getDefaultConfig,
3
- runDev,
4
- runProd
5
- } from "./chunk-C24QMDAC.js";
6
- import "./chunk-MCKGQKYU.js";
7
- export {
8
- getDefaultConfig,
9
- runDev,
10
- runProd
11
- };
File without changes