weapp-vite 1.2.1 → 1.2.2

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.2.1";
6
+ var version = "1.2.2";
7
7
 
8
8
  // src/constants.ts
9
9
  var VERSION = version;
@@ -584,7 +584,9 @@ var CompilerContext = class _CompilerContext {
584
584
  mode: "development",
585
585
  plugins: [vitePluginWeapp(this)],
586
586
  build: {
587
- watch: {},
587
+ watch: {
588
+ exclude: ["node_modules/**", this.mpDistRoot ? path5.join(this.mpDistRoot, "**") : "dist/**"]
589
+ },
588
590
  minify: false,
589
591
  emptyOutDir: false
590
592
  },
@@ -652,10 +654,24 @@ var CompilerContext = class _CompilerContext {
652
654
  }
653
655
  }
654
656
  );
655
- const output = await build(
656
- inlineConfig
657
- );
658
- return output;
657
+ if (this.type === "subPackage" && this.subPackage) {
658
+ const subPackageInlineConfig = Object.assign({}, inlineConfig, {
659
+ weapp: {
660
+ srcRoot: this.parent?.srcRoot,
661
+ type: this.type,
662
+ subPackage: this.subPackage
663
+ }
664
+ });
665
+ const output = await build(
666
+ subPackageInlineConfig
667
+ );
668
+ return output;
669
+ } else if (this.type === "app") {
670
+ const output = await build(
671
+ inlineConfig
672
+ );
673
+ return output;
674
+ }
659
675
  }
660
676
  build() {
661
677
  if (this.isDev) {
@@ -707,9 +723,6 @@ var CompilerContext = class _CompilerContext {
707
723
  commonjsOptions: {
708
724
  transformMixedEsModules: true,
709
725
  include: void 0
710
- },
711
- watch: {
712
- exclude: ["node_modules/**", this.mpDistRoot ? path5.join(this.mpDistRoot, "**") : "dist/**"]
713
726
  }
714
727
  },
715
728
  logLevel: "info",
package/dist/cli.cjs CHANGED
@@ -33,7 +33,7 @@ var import_cac = require("cac");
33
33
  var import_weapp_ide_cli = require("weapp-ide-cli");
34
34
 
35
35
  // package.json
36
- var version = "1.2.1";
36
+ var version = "1.2.2";
37
37
 
38
38
  // src/constants.ts
39
39
  var VERSION = version;
@@ -618,7 +618,9 @@ var CompilerContext = class _CompilerContext {
618
618
  mode: "development",
619
619
  plugins: [vitePluginWeapp(this)],
620
620
  build: {
621
- watch: {},
621
+ watch: {
622
+ exclude: ["node_modules/**", this.mpDistRoot ? import_pathe5.default.join(this.mpDistRoot, "**") : "dist/**"]
623
+ },
622
624
  minify: false,
623
625
  emptyOutDir: false
624
626
  },
@@ -686,10 +688,24 @@ var CompilerContext = class _CompilerContext {
686
688
  }
687
689
  }
688
690
  );
689
- const output = await (0, import_vite2.build)(
690
- inlineConfig
691
- );
692
- return output;
691
+ if (this.type === "subPackage" && this.subPackage) {
692
+ const subPackageInlineConfig = Object.assign({}, inlineConfig, {
693
+ weapp: {
694
+ srcRoot: this.parent?.srcRoot,
695
+ type: this.type,
696
+ subPackage: this.subPackage
697
+ }
698
+ });
699
+ const output = await (0, import_vite2.build)(
700
+ subPackageInlineConfig
701
+ );
702
+ return output;
703
+ } else if (this.type === "app") {
704
+ const output = await (0, import_vite2.build)(
705
+ inlineConfig
706
+ );
707
+ return output;
708
+ }
693
709
  }
694
710
  build() {
695
711
  if (this.isDev) {
@@ -741,9 +757,6 @@ var CompilerContext = class _CompilerContext {
741
757
  commonjsOptions: {
742
758
  transformMixedEsModules: true,
743
759
  include: void 0
744
- },
745
- watch: {
746
- exclude: ["node_modules/**", this.mpDistRoot ? import_pathe5.default.join(this.mpDistRoot, "**") : "dist/**"]
747
760
  }
748
761
  },
749
762
  logLevel: "info",
@@ -865,8 +878,8 @@ cli.command("build [root]", "build for production").option("--target <target>",
865
878
  mode: options.mode
866
879
  });
867
880
  await ctx.loadDefaultConfig();
868
- await ctx.buildNpm();
869
881
  await ctx.runProd();
882
+ await ctx.buildNpm();
870
883
  });
871
884
  cli.command("init").action(() => {
872
885
  try {
package/dist/cli.mjs CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  CompilerContext,
3
3
  VERSION,
4
4
  logger_default
5
- } from "./chunk-5SFYACIL.mjs";
5
+ } from "./chunk-NP647U5Z.mjs";
6
6
  import "./chunk-444MQSSG.mjs";
7
7
 
8
8
  // src/cli.ts
@@ -54,8 +54,8 @@ cli.command("build [root]", "build for production").option("--target <target>",
54
54
  mode: options.mode
55
55
  });
56
56
  await ctx.loadDefaultConfig();
57
- await ctx.buildNpm();
58
57
  await ctx.runProd();
58
+ await ctx.buildNpm();
59
59
  });
60
60
  cli.command("init").action(() => {
61
61
  try {
package/dist/index.cjs CHANGED
@@ -620,7 +620,9 @@ var CompilerContext = class _CompilerContext {
620
620
  mode: "development",
621
621
  plugins: [vitePluginWeapp(this)],
622
622
  build: {
623
- watch: {},
623
+ watch: {
624
+ exclude: ["node_modules/**", this.mpDistRoot ? import_pathe5.default.join(this.mpDistRoot, "**") : "dist/**"]
625
+ },
624
626
  minify: false,
625
627
  emptyOutDir: false
626
628
  },
@@ -688,10 +690,24 @@ var CompilerContext = class _CompilerContext {
688
690
  }
689
691
  }
690
692
  );
691
- const output = await (0, import_vite2.build)(
692
- inlineConfig
693
- );
694
- return output;
693
+ if (this.type === "subPackage" && this.subPackage) {
694
+ const subPackageInlineConfig = Object.assign({}, inlineConfig, {
695
+ weapp: {
696
+ srcRoot: this.parent?.srcRoot,
697
+ type: this.type,
698
+ subPackage: this.subPackage
699
+ }
700
+ });
701
+ const output = await (0, import_vite2.build)(
702
+ subPackageInlineConfig
703
+ );
704
+ return output;
705
+ } else if (this.type === "app") {
706
+ const output = await (0, import_vite2.build)(
707
+ inlineConfig
708
+ );
709
+ return output;
710
+ }
695
711
  }
696
712
  build() {
697
713
  if (this.isDev) {
@@ -743,9 +759,6 @@ var CompilerContext = class _CompilerContext {
743
759
  commonjsOptions: {
744
760
  transformMixedEsModules: true,
745
761
  include: void 0
746
- },
747
- watch: {
748
- exclude: ["node_modules/**", this.mpDistRoot ? import_pathe5.default.join(this.mpDistRoot, "**") : "dist/**"]
749
762
  }
750
763
  },
751
764
  logLevel: "info",
package/dist/index.d.cts CHANGED
@@ -45,8 +45,8 @@ declare class CompilerContext {
45
45
  forkSubPackage(subPackage: SubPackage): CompilerContext;
46
46
  internalDev(inlineConfig: InlineConfig): Promise<RollupWatcher>;
47
47
  runDev(): Promise<FSWatcher | undefined>;
48
- runProd(): Promise<RollupOutput | RollupOutput[]>;
49
- build(): Promise<FSWatcher | undefined> | Promise<RollupOutput | RollupOutput[]>;
48
+ runProd(): Promise<RollupOutput | RollupOutput[] | undefined>;
49
+ build(): Promise<FSWatcher | undefined> | Promise<RollupOutput | RollupOutput[] | undefined>;
50
50
  loadDefaultConfig(): Promise<void>;
51
51
  buildNpm(): Promise<void>;
52
52
  }
package/dist/index.d.ts CHANGED
@@ -45,8 +45,8 @@ declare class CompilerContext {
45
45
  forkSubPackage(subPackage: SubPackage): CompilerContext;
46
46
  internalDev(inlineConfig: InlineConfig): Promise<RollupWatcher>;
47
47
  runDev(): Promise<FSWatcher | undefined>;
48
- runProd(): Promise<RollupOutput | RollupOutput[]>;
49
- build(): Promise<FSWatcher | undefined> | Promise<RollupOutput | RollupOutput[]>;
48
+ runProd(): Promise<RollupOutput | RollupOutput[] | undefined>;
49
+ build(): Promise<FSWatcher | undefined> | Promise<RollupOutput | RollupOutput[] | undefined>;
50
50
  loadDefaultConfig(): Promise<void>;
51
51
  buildNpm(): Promise<void>;
52
52
  }
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CompilerContext
3
- } from "./chunk-5SFYACIL.mjs";
3
+ } from "./chunk-NP647U5Z.mjs";
4
4
  import "./chunk-444MQSSG.mjs";
5
5
  export {
6
6
  CompilerContext
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
3
  "type": "module",
4
- "version": "1.2.1",
4
+ "version": "1.2.2",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",