weapp-vite 1.3.1 → 1.3.3

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.
@@ -3,7 +3,7 @@ import logger from "@weapp-core/logger";
3
3
  var logger_default = logger;
4
4
 
5
5
  // package.json
6
- var version = "1.3.1";
6
+ var version = "1.3.3";
7
7
 
8
8
  // src/constants.ts
9
9
  var VERSION = version;
@@ -303,6 +303,9 @@ function vitePluginWeapp(ctx) {
303
303
  // src/context.ts
304
304
  var require2 = createRequire(import.meta.url);
305
305
  var CompilerContext = class {
306
+ /**
307
+ * loadDefaultConfig 的时候会被重新赋予
308
+ */
306
309
  inlineConfig;
307
310
  cwd;
308
311
  isDev;
@@ -324,7 +327,6 @@ var CompilerContext = class {
324
327
  projectConfig: {},
325
328
  type: "app",
326
329
  inlineConfig: {},
327
- mode: "",
328
330
  packageJson: {}
329
331
  });
330
332
  this.cwd = cwd;
@@ -394,8 +396,8 @@ var CompilerContext = class {
394
396
  }).on("ready", async () => {
395
397
  await this.internalDev(inlineConfig2);
396
398
  isReady = true;
397
- logger_default.success("\u5E94\u7528\u6784\u5EFA\u5B8C\u6210\uFF01\u6267\u884C `npm run open` \u6253\u5F00\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177");
398
- logger_default.success("\u6216\u8005\u4F7F\u7528\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\uFF0C\u5BFC\u5165\u6839\u76EE\u5F55 (`project.config.json` \u6240\u5728\u76EE\u5F55) \u67E5\u770B\u6548\u679C");
399
+ logger_default.success("\u5E94\u7528\u6784\u5EFA\u5B8C\u6210\uFF01");
400
+ logger_default.success("\u6267\u884C `npm run open` \u6253\u5F00\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\uFF0C\u6216\u8005\u76F4\u63A5\u6253\u5F00\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\uFF0C\u5BFC\u5165\u6839\u76EE\u5F55( `project.config.json` \u6240\u5728\u76EE\u5F55) \u67E5\u770B\u6548\u679C");
399
401
  });
400
402
  return watcher;
401
403
  };
@@ -491,6 +493,8 @@ var CompilerContext = class {
491
493
  mode: this.mode
492
494
  }, void 0, this.cwd);
493
495
  this.inlineConfig = defu2({
496
+ configFile: false
497
+ }, loaded?.config, {
494
498
  mode: this.mode,
495
499
  build: {
496
500
  rollupOptions: {
@@ -517,12 +521,11 @@ var CompilerContext = class {
517
521
  include: void 0
518
522
  }
519
523
  },
520
- logLevel: "warn",
521
524
  plugins: [
522
525
  tsconfigPaths()
523
526
  ],
524
- configFile: false
525
- }, loaded?.config, this.inlineConfig);
527
+ logLevel: "warn"
528
+ });
526
529
  }
527
530
  // https://cn.vitejs.dev/guide/build.html#library-mode
528
531
  // miniprogram_dist
@@ -552,7 +555,7 @@ var CompilerContext = class {
552
555
  for (const dep of dependencies) {
553
556
  const id = `${dep}/package.json`;
554
557
  const targetJson = require2(id);
555
- if ("miniprogram" in targetJson && targetJson.miniprogram) {
558
+ if (Reflect.has(targetJson, "miniprogram") && targetJson.miniprogram) {
556
559
  const targetJsonPath = require2.resolve(id);
557
560
  await fs6.copy(
558
561
  path5.resolve(
@@ -603,7 +606,12 @@ var CompilerContext = class {
603
606
  }
604
607
  }
605
608
  }
609
+ resetEntries() {
610
+ this.entriesSet.clear();
611
+ this.entries.length = 0;
612
+ }
606
613
  async scanAppEntry() {
614
+ this.resetEntries();
607
615
  const appDirname = path5.resolve(this.cwd, this.srcRoot);
608
616
  const appConfigFile = path5.resolve(appDirname, "app.json");
609
617
  const appEntry = await findJsEntry(appConfigFile);
package/dist/cli.cjs CHANGED
@@ -32,7 +32,7 @@ var import_cac = require("cac");
32
32
  var import_weapp_ide_cli = require("weapp-ide-cli");
33
33
 
34
34
  // package.json
35
- var version = "1.3.1";
35
+ var version = "1.3.3";
36
36
 
37
37
  // src/constants.ts
38
38
  var VERSION = version;
@@ -336,6 +336,9 @@ function vitePluginWeapp(ctx) {
336
336
  // src/context.ts
337
337
  var require2 = (0, import_node_module.createRequire)(importMetaUrl);
338
338
  var CompilerContext = class {
339
+ /**
340
+ * loadDefaultConfig 的时候会被重新赋予
341
+ */
339
342
  inlineConfig;
340
343
  cwd;
341
344
  isDev;
@@ -357,7 +360,6 @@ var CompilerContext = class {
357
360
  projectConfig: {},
358
361
  type: "app",
359
362
  inlineConfig: {},
360
- mode: "",
361
363
  packageJson: {}
362
364
  });
363
365
  this.cwd = cwd;
@@ -427,8 +429,8 @@ var CompilerContext = class {
427
429
  }).on("ready", async () => {
428
430
  await this.internalDev(inlineConfig2);
429
431
  isReady = true;
430
- logger_default.success("\u5E94\u7528\u6784\u5EFA\u5B8C\u6210\uFF01\u6267\u884C `npm run open` \u6253\u5F00\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177");
431
- logger_default.success("\u6216\u8005\u4F7F\u7528\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\uFF0C\u5BFC\u5165\u6839\u76EE\u5F55 (`project.config.json` \u6240\u5728\u76EE\u5F55) \u67E5\u770B\u6548\u679C");
432
+ logger_default.success("\u5E94\u7528\u6784\u5EFA\u5B8C\u6210\uFF01");
433
+ logger_default.success("\u6267\u884C `npm run open` \u6253\u5F00\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\uFF0C\u6216\u8005\u76F4\u63A5\u6253\u5F00\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\uFF0C\u5BFC\u5165\u6839\u76EE\u5F55( `project.config.json` \u6240\u5728\u76EE\u5F55) \u67E5\u770B\u6548\u679C");
432
434
  });
433
435
  return watcher;
434
436
  };
@@ -524,6 +526,8 @@ var CompilerContext = class {
524
526
  mode: this.mode
525
527
  }, void 0, this.cwd);
526
528
  this.inlineConfig = (0, import_shared3.defu)({
529
+ configFile: false
530
+ }, loaded?.config, {
527
531
  mode: this.mode,
528
532
  build: {
529
533
  rollupOptions: {
@@ -550,12 +554,11 @@ var CompilerContext = class {
550
554
  include: void 0
551
555
  }
552
556
  },
553
- logLevel: "warn",
554
557
  plugins: [
555
558
  (0, import_vite_tsconfig_paths.default)()
556
559
  ],
557
- configFile: false
558
- }, loaded?.config, this.inlineConfig);
560
+ logLevel: "warn"
561
+ });
559
562
  }
560
563
  // https://cn.vitejs.dev/guide/build.html#library-mode
561
564
  // miniprogram_dist
@@ -585,7 +588,7 @@ var CompilerContext = class {
585
588
  for (const dep of dependencies) {
586
589
  const id = `${dep}/package.json`;
587
590
  const targetJson = require2(id);
588
- if ("miniprogram" in targetJson && targetJson.miniprogram) {
591
+ if (Reflect.has(targetJson, "miniprogram") && targetJson.miniprogram) {
589
592
  const targetJsonPath = require2.resolve(id);
590
593
  await import_fs_extra6.default.copy(
591
594
  import_pathe5.default.resolve(
@@ -636,7 +639,12 @@ var CompilerContext = class {
636
639
  }
637
640
  }
638
641
  }
642
+ resetEntries() {
643
+ this.entriesSet.clear();
644
+ this.entries.length = 0;
645
+ }
639
646
  async scanAppEntry() {
647
+ this.resetEntries();
640
648
  const appDirname = import_pathe5.default.resolve(this.cwd, this.srcRoot);
641
649
  const appConfigFile = import_pathe5.default.resolve(appDirname, "app.json");
642
650
  const appEntry = await findJsEntry(appConfigFile);
package/dist/cli.mjs CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  VERSION,
3
3
  createCompilerContext,
4
4
  logger_default
5
- } from "./chunk-JB72VL2I.mjs";
5
+ } from "./chunk-EA52OCYF.mjs";
6
6
  import "./chunk-444MQSSG.mjs";
7
7
 
8
8
  // src/cli.ts
package/dist/index.cjs CHANGED
@@ -340,6 +340,9 @@ function vitePluginWeapp(ctx) {
340
340
  // src/context.ts
341
341
  var require2 = (0, import_node_module.createRequire)(importMetaUrl);
342
342
  var CompilerContext = class {
343
+ /**
344
+ * loadDefaultConfig 的时候会被重新赋予
345
+ */
343
346
  inlineConfig;
344
347
  cwd;
345
348
  isDev;
@@ -361,7 +364,6 @@ var CompilerContext = class {
361
364
  projectConfig: {},
362
365
  type: "app",
363
366
  inlineConfig: {},
364
- mode: "",
365
367
  packageJson: {}
366
368
  });
367
369
  this.cwd = cwd;
@@ -431,8 +433,8 @@ var CompilerContext = class {
431
433
  }).on("ready", async () => {
432
434
  await this.internalDev(inlineConfig2);
433
435
  isReady = true;
434
- logger_default.success("\u5E94\u7528\u6784\u5EFA\u5B8C\u6210\uFF01\u6267\u884C `npm run open` \u6253\u5F00\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177");
435
- logger_default.success("\u6216\u8005\u4F7F\u7528\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\uFF0C\u5BFC\u5165\u6839\u76EE\u5F55 (`project.config.json` \u6240\u5728\u76EE\u5F55) \u67E5\u770B\u6548\u679C");
436
+ logger_default.success("\u5E94\u7528\u6784\u5EFA\u5B8C\u6210\uFF01");
437
+ logger_default.success("\u6267\u884C `npm run open` \u6253\u5F00\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\uFF0C\u6216\u8005\u76F4\u63A5\u6253\u5F00\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\uFF0C\u5BFC\u5165\u6839\u76EE\u5F55( `project.config.json` \u6240\u5728\u76EE\u5F55) \u67E5\u770B\u6548\u679C");
436
438
  });
437
439
  return watcher;
438
440
  };
@@ -528,6 +530,8 @@ var CompilerContext = class {
528
530
  mode: this.mode
529
531
  }, void 0, this.cwd);
530
532
  this.inlineConfig = (0, import_shared3.defu)({
533
+ configFile: false
534
+ }, loaded?.config, {
531
535
  mode: this.mode,
532
536
  build: {
533
537
  rollupOptions: {
@@ -554,12 +558,11 @@ var CompilerContext = class {
554
558
  include: void 0
555
559
  }
556
560
  },
557
- logLevel: "warn",
558
561
  plugins: [
559
562
  (0, import_vite_tsconfig_paths.default)()
560
563
  ],
561
- configFile: false
562
- }, loaded?.config, this.inlineConfig);
564
+ logLevel: "warn"
565
+ });
563
566
  }
564
567
  // https://cn.vitejs.dev/guide/build.html#library-mode
565
568
  // miniprogram_dist
@@ -589,7 +592,7 @@ var CompilerContext = class {
589
592
  for (const dep of dependencies) {
590
593
  const id = `${dep}/package.json`;
591
594
  const targetJson = require2(id);
592
- if ("miniprogram" in targetJson && targetJson.miniprogram) {
595
+ if (Reflect.has(targetJson, "miniprogram") && targetJson.miniprogram) {
593
596
  const targetJsonPath = require2.resolve(id);
594
597
  await import_fs_extra6.default.copy(
595
598
  import_pathe5.default.resolve(
@@ -640,7 +643,12 @@ var CompilerContext = class {
640
643
  }
641
644
  }
642
645
  }
646
+ resetEntries() {
647
+ this.entriesSet.clear();
648
+ this.entries.length = 0;
649
+ }
643
650
  async scanAppEntry() {
651
+ this.resetEntries();
644
652
  const appDirname = import_pathe5.default.resolve(this.cwd, this.srcRoot);
645
653
  const appConfigFile = import_pathe5.default.resolve(appDirname, "app.json");
646
654
  const appEntry = await findJsEntry(appConfigFile);
package/dist/index.d.cts CHANGED
@@ -32,6 +32,9 @@ interface CompilerContextOptions {
32
32
  subPackage?: SubPackage;
33
33
  }
34
34
  declare class CompilerContext {
35
+ /**
36
+ * loadDefaultConfig 的时候会被重新赋予
37
+ */
35
38
  inlineConfig: InlineConfig;
36
39
  cwd: string;
37
40
  isDev: boolean;
@@ -59,6 +62,7 @@ declare class CompilerContext {
59
62
  sourcemap?: boolean;
60
63
  }): Promise<void>;
61
64
  private usingComponentsHandler;
65
+ resetEntries(): void;
62
66
  scanAppEntry(): Promise<void>;
63
67
  scanComponentEntry(componentEntry: string, dirname: string): Promise<void>;
64
68
  }
package/dist/index.d.ts CHANGED
@@ -32,6 +32,9 @@ interface CompilerContextOptions {
32
32
  subPackage?: SubPackage;
33
33
  }
34
34
  declare class CompilerContext {
35
+ /**
36
+ * loadDefaultConfig 的时候会被重新赋予
37
+ */
35
38
  inlineConfig: InlineConfig;
36
39
  cwd: string;
37
40
  isDev: boolean;
@@ -59,6 +62,7 @@ declare class CompilerContext {
59
62
  sourcemap?: boolean;
60
63
  }): Promise<void>;
61
64
  private usingComponentsHandler;
65
+ resetEntries(): void;
62
66
  scanAppEntry(): Promise<void>;
63
67
  scanComponentEntry(componentEntry: string, dirname: string): Promise<void>;
64
68
  }
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  CompilerContext,
3
3
  createCompilerContext
4
- } from "./chunk-JB72VL2I.mjs";
4
+ } from "./chunk-EA52OCYF.mjs";
5
5
  import "./chunk-444MQSSG.mjs";
6
6
  export {
7
7
  CompilerContext,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
3
  "type": "module",
4
- "version": "1.3.1",
4
+ "version": "1.3.3",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -63,8 +63,8 @@
63
63
  "vite-tsconfig-paths": "^5.0.1",
64
64
  "@weapp-core/init": "^1.0.5",
65
65
  "@weapp-core/logger": "^1.0.1",
66
- "@weapp-core/shared": "^1.0.1",
67
- "weapp-ide-cli": "^2.0.6"
66
+ "weapp-ide-cli": "^2.0.6",
67
+ "@weapp-core/shared": "^1.0.1"
68
68
  },
69
69
  "publishConfig": {
70
70
  "access": "public",