weapp-vite 1.2.0 → 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.
- package/dist/{chunk-3EHL3BIF.mjs → chunk-NP647U5Z.mjs} +51 -48
- package/dist/cli.cjs +51 -53
- package/dist/cli.mjs +4 -9
- package/dist/index.cjs +49 -47
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
// src/logger.ts
|
|
2
|
+
import logger from "@weapp-core/logger";
|
|
3
|
+
var logger_default = logger;
|
|
4
|
+
|
|
1
5
|
// package.json
|
|
2
|
-
var version = "1.2.
|
|
6
|
+
var version = "1.2.2";
|
|
3
7
|
|
|
4
8
|
// src/constants.ts
|
|
5
9
|
var VERSION = version;
|
|
@@ -46,7 +50,7 @@ function createDebugger(namespace) {
|
|
|
46
50
|
// src/entry.ts
|
|
47
51
|
import process from "node:process";
|
|
48
52
|
import { defu as defu2 } from "@weapp-core/shared";
|
|
49
|
-
import
|
|
53
|
+
import { fdir as Fdir } from "fdir";
|
|
50
54
|
import mm from "micromatch";
|
|
51
55
|
import path3 from "pathe";
|
|
52
56
|
|
|
@@ -230,21 +234,15 @@ async function getEntries(options) {
|
|
|
230
234
|
type: "subPackageEntry"
|
|
231
235
|
});
|
|
232
236
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
{
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
if (entry) {
|
|
243
|
-
if (entry.type === "component") {
|
|
244
|
-
componentEntries.push(entry);
|
|
245
|
-
} else if (entry.type === "page") {
|
|
246
|
-
pageEntries.push(entry);
|
|
247
|
-
}
|
|
237
|
+
const files = await new Fdir().withFullPaths().filter(filter).crawl(path3.join(root, subPackageRoot)).withPromise();
|
|
238
|
+
for (const file of files) {
|
|
239
|
+
if (/\.wxml$/.test(file)) {
|
|
240
|
+
const entry = getWxmlEntry(file, formatPath);
|
|
241
|
+
if (entry) {
|
|
242
|
+
if (entry.type === "component") {
|
|
243
|
+
componentEntries.push(entry);
|
|
244
|
+
} else if (entry.type === "page") {
|
|
245
|
+
pageEntries.push(entry);
|
|
248
246
|
}
|
|
249
247
|
}
|
|
250
248
|
}
|
|
@@ -274,21 +272,15 @@ async function getEntries(options) {
|
|
|
274
272
|
);
|
|
275
273
|
const pageEntries = [];
|
|
276
274
|
const componentEntries = [];
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
{
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
if (entry) {
|
|
287
|
-
if (entry.type === "component") {
|
|
288
|
-
componentEntries.push(entry);
|
|
289
|
-
} else if (entry.type === "page") {
|
|
290
|
-
pageEntries.push(entry);
|
|
291
|
-
}
|
|
275
|
+
const files = await new Fdir().withFullPaths().filter(filter).crawl(path3.join(root, srcRoot)).withPromise();
|
|
276
|
+
for (const file of files) {
|
|
277
|
+
if (/\.wxml$/.test(file)) {
|
|
278
|
+
const entry = getWxmlEntry(file, formatPath);
|
|
279
|
+
if (entry) {
|
|
280
|
+
if (entry.type === "component") {
|
|
281
|
+
componentEntries.push(entry);
|
|
282
|
+
} else if (entry.type === "page") {
|
|
283
|
+
pageEntries.push(entry);
|
|
292
284
|
}
|
|
293
285
|
}
|
|
294
286
|
}
|
|
@@ -298,7 +290,6 @@ async function getEntries(options) {
|
|
|
298
290
|
pages: pageEntries,
|
|
299
291
|
components: componentEntries,
|
|
300
292
|
subPackages: subPackageDeps
|
|
301
|
-
// walkPathsSet,
|
|
302
293
|
};
|
|
303
294
|
}
|
|
304
295
|
}
|
|
@@ -558,12 +549,6 @@ var CompilerContext = class _CompilerContext {
|
|
|
558
549
|
get mpDistRoot() {
|
|
559
550
|
return this.projectConfig.miniprogramRoot || this.projectConfig.srcMiniprogramRoot || "";
|
|
560
551
|
}
|
|
561
|
-
// get weappConfig() {
|
|
562
|
-
// return this.inlineConfig.weapp
|
|
563
|
-
// }
|
|
564
|
-
// get inlineSubPackageConfig() {
|
|
565
|
-
// return this.weappConfig?.subPackage
|
|
566
|
-
// }
|
|
567
552
|
forkSubPackage(subPackage) {
|
|
568
553
|
const ctx = new _CompilerContext({
|
|
569
554
|
cwd: this.cwd,
|
|
@@ -599,7 +584,9 @@ var CompilerContext = class _CompilerContext {
|
|
|
599
584
|
mode: "development",
|
|
600
585
|
plugins: [vitePluginWeapp(this)],
|
|
601
586
|
build: {
|
|
602
|
-
watch: {
|
|
587
|
+
watch: {
|
|
588
|
+
exclude: ["node_modules/**", this.mpDistRoot ? path5.join(this.mpDistRoot, "**") : "dist/**"]
|
|
589
|
+
},
|
|
603
590
|
minify: false,
|
|
604
591
|
emptyOutDir: false
|
|
605
592
|
},
|
|
@@ -667,10 +654,24 @@ var CompilerContext = class _CompilerContext {
|
|
|
667
654
|
}
|
|
668
655
|
}
|
|
669
656
|
);
|
|
670
|
-
|
|
671
|
-
inlineConfig
|
|
672
|
-
|
|
673
|
-
|
|
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
|
+
}
|
|
674
675
|
}
|
|
675
676
|
build() {
|
|
676
677
|
if (this.isDev) {
|
|
@@ -722,11 +723,9 @@ var CompilerContext = class _CompilerContext {
|
|
|
722
723
|
commonjsOptions: {
|
|
723
724
|
transformMixedEsModules: true,
|
|
724
725
|
include: void 0
|
|
725
|
-
},
|
|
726
|
-
watch: {
|
|
727
|
-
exclude: ["node_modules/**", this.mpDistRoot ? path5.join(this.mpDistRoot, "**") : "dist/**"]
|
|
728
726
|
}
|
|
729
727
|
},
|
|
728
|
+
logLevel: "info",
|
|
730
729
|
plugins: [
|
|
731
730
|
tsconfigPaths()
|
|
732
731
|
],
|
|
@@ -784,11 +783,14 @@ var CompilerContext = class _CompilerContext {
|
|
|
784
783
|
strict: false,
|
|
785
784
|
entryFileNames: "[name].js"
|
|
786
785
|
}
|
|
786
|
+
// logLevel: 'silent',
|
|
787
787
|
},
|
|
788
788
|
assetsDir: "."
|
|
789
|
-
}
|
|
789
|
+
},
|
|
790
|
+
logLevel: "error"
|
|
790
791
|
});
|
|
791
792
|
}
|
|
793
|
+
logger_default.success(`${dep} \u4F9D\u8D56\u5904\u7406\u5B8C\u6210!`);
|
|
792
794
|
}
|
|
793
795
|
}
|
|
794
796
|
}
|
|
@@ -798,6 +800,7 @@ var CompilerContext = class _CompilerContext {
|
|
|
798
800
|
};
|
|
799
801
|
|
|
800
802
|
export {
|
|
803
|
+
logger_default,
|
|
801
804
|
VERSION,
|
|
802
805
|
CompilerContext
|
|
803
806
|
};
|
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.
|
|
36
|
+
var version = "1.2.2";
|
|
37
37
|
|
|
38
38
|
// src/constants.ts
|
|
39
39
|
var VERSION = version;
|
|
@@ -60,6 +60,10 @@ function getWeappWatchOptions() {
|
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
// src/logger.ts
|
|
64
|
+
var import_logger = __toESM(require("@weapp-core/logger"), 1);
|
|
65
|
+
var logger_default = import_logger.default;
|
|
66
|
+
|
|
63
67
|
// src/plugins/index.ts
|
|
64
68
|
var import_shared3 = require("@weapp-core/shared");
|
|
65
69
|
var import_fast_glob = __toESM(require("fast-glob"), 1);
|
|
@@ -80,7 +84,7 @@ function createDebugger(namespace) {
|
|
|
80
84
|
// src/entry.ts
|
|
81
85
|
var import_node_process = __toESM(require("process"), 1);
|
|
82
86
|
var import_shared2 = require("@weapp-core/shared");
|
|
83
|
-
var
|
|
87
|
+
var import_fdir = require("fdir");
|
|
84
88
|
var import_micromatch = __toESM(require("micromatch"), 1);
|
|
85
89
|
var import_pathe3 = __toESM(require("pathe"), 1);
|
|
86
90
|
|
|
@@ -264,21 +268,15 @@ async function getEntries(options) {
|
|
|
264
268
|
type: "subPackageEntry"
|
|
265
269
|
});
|
|
266
270
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
{
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
if (entry) {
|
|
277
|
-
if (entry.type === "component") {
|
|
278
|
-
componentEntries.push(entry);
|
|
279
|
-
} else if (entry.type === "page") {
|
|
280
|
-
pageEntries.push(entry);
|
|
281
|
-
}
|
|
271
|
+
const files = await new import_fdir.fdir().withFullPaths().filter(filter).crawl(import_pathe3.default.join(root, subPackageRoot)).withPromise();
|
|
272
|
+
for (const file of files) {
|
|
273
|
+
if (/\.wxml$/.test(file)) {
|
|
274
|
+
const entry = getWxmlEntry(file, formatPath);
|
|
275
|
+
if (entry) {
|
|
276
|
+
if (entry.type === "component") {
|
|
277
|
+
componentEntries.push(entry);
|
|
278
|
+
} else if (entry.type === "page") {
|
|
279
|
+
pageEntries.push(entry);
|
|
282
280
|
}
|
|
283
281
|
}
|
|
284
282
|
}
|
|
@@ -308,21 +306,15 @@ async function getEntries(options) {
|
|
|
308
306
|
);
|
|
309
307
|
const pageEntries = [];
|
|
310
308
|
const componentEntries = [];
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
{
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
if (entry) {
|
|
321
|
-
if (entry.type === "component") {
|
|
322
|
-
componentEntries.push(entry);
|
|
323
|
-
} else if (entry.type === "page") {
|
|
324
|
-
pageEntries.push(entry);
|
|
325
|
-
}
|
|
309
|
+
const files = await new import_fdir.fdir().withFullPaths().filter(filter).crawl(import_pathe3.default.join(root, srcRoot)).withPromise();
|
|
310
|
+
for (const file of files) {
|
|
311
|
+
if (/\.wxml$/.test(file)) {
|
|
312
|
+
const entry = getWxmlEntry(file, formatPath);
|
|
313
|
+
if (entry) {
|
|
314
|
+
if (entry.type === "component") {
|
|
315
|
+
componentEntries.push(entry);
|
|
316
|
+
} else if (entry.type === "page") {
|
|
317
|
+
pageEntries.push(entry);
|
|
326
318
|
}
|
|
327
319
|
}
|
|
328
320
|
}
|
|
@@ -332,7 +324,6 @@ async function getEntries(options) {
|
|
|
332
324
|
pages: pageEntries,
|
|
333
325
|
components: componentEntries,
|
|
334
326
|
subPackages: subPackageDeps
|
|
335
|
-
// walkPathsSet,
|
|
336
327
|
};
|
|
337
328
|
}
|
|
338
329
|
}
|
|
@@ -592,12 +583,6 @@ var CompilerContext = class _CompilerContext {
|
|
|
592
583
|
get mpDistRoot() {
|
|
593
584
|
return this.projectConfig.miniprogramRoot || this.projectConfig.srcMiniprogramRoot || "";
|
|
594
585
|
}
|
|
595
|
-
// get weappConfig() {
|
|
596
|
-
// return this.inlineConfig.weapp
|
|
597
|
-
// }
|
|
598
|
-
// get inlineSubPackageConfig() {
|
|
599
|
-
// return this.weappConfig?.subPackage
|
|
600
|
-
// }
|
|
601
586
|
forkSubPackage(subPackage) {
|
|
602
587
|
const ctx = new _CompilerContext({
|
|
603
588
|
cwd: this.cwd,
|
|
@@ -633,7 +618,9 @@ var CompilerContext = class _CompilerContext {
|
|
|
633
618
|
mode: "development",
|
|
634
619
|
plugins: [vitePluginWeapp(this)],
|
|
635
620
|
build: {
|
|
636
|
-
watch: {
|
|
621
|
+
watch: {
|
|
622
|
+
exclude: ["node_modules/**", this.mpDistRoot ? import_pathe5.default.join(this.mpDistRoot, "**") : "dist/**"]
|
|
623
|
+
},
|
|
637
624
|
minify: false,
|
|
638
625
|
emptyOutDir: false
|
|
639
626
|
},
|
|
@@ -701,10 +688,24 @@ var CompilerContext = class _CompilerContext {
|
|
|
701
688
|
}
|
|
702
689
|
}
|
|
703
690
|
);
|
|
704
|
-
|
|
705
|
-
inlineConfig
|
|
706
|
-
|
|
707
|
-
|
|
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
|
+
}
|
|
708
709
|
}
|
|
709
710
|
build() {
|
|
710
711
|
if (this.isDev) {
|
|
@@ -756,11 +757,9 @@ var CompilerContext = class _CompilerContext {
|
|
|
756
757
|
commonjsOptions: {
|
|
757
758
|
transformMixedEsModules: true,
|
|
758
759
|
include: void 0
|
|
759
|
-
},
|
|
760
|
-
watch: {
|
|
761
|
-
exclude: ["node_modules/**", this.mpDistRoot ? import_pathe5.default.join(this.mpDistRoot, "**") : "dist/**"]
|
|
762
760
|
}
|
|
763
761
|
},
|
|
762
|
+
logLevel: "info",
|
|
764
763
|
plugins: [
|
|
765
764
|
(0, import_vite_tsconfig_paths.default)()
|
|
766
765
|
],
|
|
@@ -818,11 +817,14 @@ var CompilerContext = class _CompilerContext {
|
|
|
818
817
|
strict: false,
|
|
819
818
|
entryFileNames: "[name].js"
|
|
820
819
|
}
|
|
820
|
+
// logLevel: 'silent',
|
|
821
821
|
},
|
|
822
822
|
assetsDir: "."
|
|
823
|
-
}
|
|
823
|
+
},
|
|
824
|
+
logLevel: "error"
|
|
824
825
|
});
|
|
825
826
|
}
|
|
827
|
+
logger_default.success(`${dep} \u4F9D\u8D56\u5904\u7406\u5B8C\u6210!`);
|
|
826
828
|
}
|
|
827
829
|
}
|
|
828
830
|
}
|
|
@@ -831,10 +833,6 @@ var CompilerContext = class _CompilerContext {
|
|
|
831
833
|
}
|
|
832
834
|
};
|
|
833
835
|
|
|
834
|
-
// src/logger.ts
|
|
835
|
-
var import_logger = __toESM(require("@weapp-core/logger"), 1);
|
|
836
|
-
var logger_default = import_logger.default;
|
|
837
|
-
|
|
838
836
|
// src/cli.ts
|
|
839
837
|
var cli = (0, import_cac.cac)("weapp-vite");
|
|
840
838
|
function filterDuplicateOptions(options) {
|
|
@@ -880,8 +878,8 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
|
880
878
|
mode: options.mode
|
|
881
879
|
});
|
|
882
880
|
await ctx.loadDefaultConfig();
|
|
883
|
-
await ctx.buildNpm();
|
|
884
881
|
await ctx.runProd();
|
|
882
|
+
await ctx.buildNpm();
|
|
885
883
|
});
|
|
886
884
|
cli.command("init").action(() => {
|
|
887
885
|
try {
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CompilerContext,
|
|
3
|
-
VERSION
|
|
4
|
-
|
|
3
|
+
VERSION,
|
|
4
|
+
logger_default
|
|
5
|
+
} from "./chunk-NP647U5Z.mjs";
|
|
5
6
|
import "./chunk-444MQSSG.mjs";
|
|
6
7
|
|
|
7
8
|
// src/cli.ts
|
|
@@ -9,12 +10,6 @@ import process from "node:process";
|
|
|
9
10
|
import { initConfig } from "@weapp-core/init";
|
|
10
11
|
import { cac } from "cac";
|
|
11
12
|
import { parse } from "weapp-ide-cli";
|
|
12
|
-
|
|
13
|
-
// src/logger.ts
|
|
14
|
-
import logger from "@weapp-core/logger";
|
|
15
|
-
var logger_default = logger;
|
|
16
|
-
|
|
17
|
-
// src/cli.ts
|
|
18
13
|
var cli = cac("weapp-vite");
|
|
19
14
|
function filterDuplicateOptions(options) {
|
|
20
15
|
for (const [key, value] of Object.entries(options)) {
|
|
@@ -59,8 +54,8 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
|
59
54
|
mode: options.mode
|
|
60
55
|
});
|
|
61
56
|
await ctx.loadDefaultConfig();
|
|
62
|
-
await ctx.buildNpm();
|
|
63
57
|
await ctx.runProd();
|
|
58
|
+
await ctx.buildNpm();
|
|
64
59
|
});
|
|
65
60
|
cli.command("init").action(() => {
|
|
66
61
|
try {
|
package/dist/index.cjs
CHANGED
|
@@ -59,6 +59,10 @@ function getWeappWatchOptions() {
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
// src/logger.ts
|
|
63
|
+
var import_logger = __toESM(require("@weapp-core/logger"), 1);
|
|
64
|
+
var logger_default = import_logger.default;
|
|
65
|
+
|
|
62
66
|
// src/plugins/index.ts
|
|
63
67
|
var import_shared3 = require("@weapp-core/shared");
|
|
64
68
|
var import_fast_glob = __toESM(require("fast-glob"), 1);
|
|
@@ -82,7 +86,7 @@ function createDebugger(namespace) {
|
|
|
82
86
|
// src/entry.ts
|
|
83
87
|
var import_node_process = __toESM(require("process"), 1);
|
|
84
88
|
var import_shared2 = require("@weapp-core/shared");
|
|
85
|
-
var
|
|
89
|
+
var import_fdir = require("fdir");
|
|
86
90
|
var import_micromatch = __toESM(require("micromatch"), 1);
|
|
87
91
|
var import_pathe3 = __toESM(require("pathe"), 1);
|
|
88
92
|
|
|
@@ -266,21 +270,15 @@ async function getEntries(options) {
|
|
|
266
270
|
type: "subPackageEntry"
|
|
267
271
|
});
|
|
268
272
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
{
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
if (entry) {
|
|
279
|
-
if (entry.type === "component") {
|
|
280
|
-
componentEntries.push(entry);
|
|
281
|
-
} else if (entry.type === "page") {
|
|
282
|
-
pageEntries.push(entry);
|
|
283
|
-
}
|
|
273
|
+
const files = await new import_fdir.fdir().withFullPaths().filter(filter).crawl(import_pathe3.default.join(root, subPackageRoot)).withPromise();
|
|
274
|
+
for (const file of files) {
|
|
275
|
+
if (/\.wxml$/.test(file)) {
|
|
276
|
+
const entry = getWxmlEntry(file, formatPath);
|
|
277
|
+
if (entry) {
|
|
278
|
+
if (entry.type === "component") {
|
|
279
|
+
componentEntries.push(entry);
|
|
280
|
+
} else if (entry.type === "page") {
|
|
281
|
+
pageEntries.push(entry);
|
|
284
282
|
}
|
|
285
283
|
}
|
|
286
284
|
}
|
|
@@ -310,21 +308,15 @@ async function getEntries(options) {
|
|
|
310
308
|
);
|
|
311
309
|
const pageEntries = [];
|
|
312
310
|
const componentEntries = [];
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
{
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
if (entry) {
|
|
323
|
-
if (entry.type === "component") {
|
|
324
|
-
componentEntries.push(entry);
|
|
325
|
-
} else if (entry.type === "page") {
|
|
326
|
-
pageEntries.push(entry);
|
|
327
|
-
}
|
|
311
|
+
const files = await new import_fdir.fdir().withFullPaths().filter(filter).crawl(import_pathe3.default.join(root, srcRoot)).withPromise();
|
|
312
|
+
for (const file of files) {
|
|
313
|
+
if (/\.wxml$/.test(file)) {
|
|
314
|
+
const entry = getWxmlEntry(file, formatPath);
|
|
315
|
+
if (entry) {
|
|
316
|
+
if (entry.type === "component") {
|
|
317
|
+
componentEntries.push(entry);
|
|
318
|
+
} else if (entry.type === "page") {
|
|
319
|
+
pageEntries.push(entry);
|
|
328
320
|
}
|
|
329
321
|
}
|
|
330
322
|
}
|
|
@@ -334,7 +326,6 @@ async function getEntries(options) {
|
|
|
334
326
|
pages: pageEntries,
|
|
335
327
|
components: componentEntries,
|
|
336
328
|
subPackages: subPackageDeps
|
|
337
|
-
// walkPathsSet,
|
|
338
329
|
};
|
|
339
330
|
}
|
|
340
331
|
}
|
|
@@ -594,12 +585,6 @@ var CompilerContext = class _CompilerContext {
|
|
|
594
585
|
get mpDistRoot() {
|
|
595
586
|
return this.projectConfig.miniprogramRoot || this.projectConfig.srcMiniprogramRoot || "";
|
|
596
587
|
}
|
|
597
|
-
// get weappConfig() {
|
|
598
|
-
// return this.inlineConfig.weapp
|
|
599
|
-
// }
|
|
600
|
-
// get inlineSubPackageConfig() {
|
|
601
|
-
// return this.weappConfig?.subPackage
|
|
602
|
-
// }
|
|
603
588
|
forkSubPackage(subPackage) {
|
|
604
589
|
const ctx = new _CompilerContext({
|
|
605
590
|
cwd: this.cwd,
|
|
@@ -635,7 +620,9 @@ var CompilerContext = class _CompilerContext {
|
|
|
635
620
|
mode: "development",
|
|
636
621
|
plugins: [vitePluginWeapp(this)],
|
|
637
622
|
build: {
|
|
638
|
-
watch: {
|
|
623
|
+
watch: {
|
|
624
|
+
exclude: ["node_modules/**", this.mpDistRoot ? import_pathe5.default.join(this.mpDistRoot, "**") : "dist/**"]
|
|
625
|
+
},
|
|
639
626
|
minify: false,
|
|
640
627
|
emptyOutDir: false
|
|
641
628
|
},
|
|
@@ -703,10 +690,24 @@ var CompilerContext = class _CompilerContext {
|
|
|
703
690
|
}
|
|
704
691
|
}
|
|
705
692
|
);
|
|
706
|
-
|
|
707
|
-
inlineConfig
|
|
708
|
-
|
|
709
|
-
|
|
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
|
+
}
|
|
710
711
|
}
|
|
711
712
|
build() {
|
|
712
713
|
if (this.isDev) {
|
|
@@ -758,11 +759,9 @@ var CompilerContext = class _CompilerContext {
|
|
|
758
759
|
commonjsOptions: {
|
|
759
760
|
transformMixedEsModules: true,
|
|
760
761
|
include: void 0
|
|
761
|
-
},
|
|
762
|
-
watch: {
|
|
763
|
-
exclude: ["node_modules/**", this.mpDistRoot ? import_pathe5.default.join(this.mpDistRoot, "**") : "dist/**"]
|
|
764
762
|
}
|
|
765
763
|
},
|
|
764
|
+
logLevel: "info",
|
|
766
765
|
plugins: [
|
|
767
766
|
(0, import_vite_tsconfig_paths.default)()
|
|
768
767
|
],
|
|
@@ -820,11 +819,14 @@ var CompilerContext = class _CompilerContext {
|
|
|
820
819
|
strict: false,
|
|
821
820
|
entryFileNames: "[name].js"
|
|
822
821
|
}
|
|
822
|
+
// logLevel: 'silent',
|
|
823
823
|
},
|
|
824
824
|
assetsDir: "."
|
|
825
|
-
}
|
|
825
|
+
},
|
|
826
|
+
logLevel: "error"
|
|
826
827
|
});
|
|
827
828
|
}
|
|
829
|
+
logger_default.success(`${dep} \u4F9D\u8D56\u5904\u7406\u5B8C\u6210!`);
|
|
828
830
|
}
|
|
829
831
|
}
|
|
830
832
|
}
|
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
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.2",
|
|
5
5
|
"description": "weapp-vite 一个现代化的小程序打包工具",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -54,18 +54,18 @@
|
|
|
54
54
|
"chokidar": "^3.6.0",
|
|
55
55
|
"debug": "^4.3.7",
|
|
56
56
|
"fast-glob": "^3.3.2",
|
|
57
|
+
"fdir": "^6.3.0",
|
|
57
58
|
"fs-extra": "^11.2.0",
|
|
58
59
|
"htmlparser2": "^9.1.0",
|
|
59
|
-
"klaw": "^4.1.0",
|
|
60
60
|
"magic-string": "^0.30.11",
|
|
61
61
|
"micromatch": "^4.0.8",
|
|
62
62
|
"pathe": "^1.1.2",
|
|
63
63
|
"picocolors": "^1.1.0",
|
|
64
64
|
"pkg-types": "^1.2.0",
|
|
65
65
|
"vite-tsconfig-paths": "^5.0.1",
|
|
66
|
+
"@weapp-core/init": "^1.0.4",
|
|
66
67
|
"@weapp-core/logger": "^1.0.1",
|
|
67
68
|
"@weapp-core/shared": "^1.0.1",
|
|
68
|
-
"@weapp-core/init": "^1.0.4",
|
|
69
69
|
"weapp-ide-cli": "^2.0.5"
|
|
70
70
|
},
|
|
71
71
|
"publishConfig": {
|