weapp-vite 1.2.2 → 1.2.4
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-NP647U5Z.mjs → chunk-7CROAIKY.mjs} +17 -20
- package/dist/cli.cjs +25 -31
- package/dist/cli.mjs +9 -12
- package/dist/index.cjs +16 -19
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +1 -1
- package/package.json +4 -3
|
@@ -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.
|
|
6
|
+
var version = "1.2.4";
|
|
7
7
|
|
|
8
8
|
// src/constants.ts
|
|
9
9
|
var VERSION = version;
|
|
@@ -16,6 +16,7 @@ import { addExtension as addExtension3, defu as defu3, removeExtension as remove
|
|
|
16
16
|
import { watch } from "chokidar";
|
|
17
17
|
import fs4 from "fs-extra";
|
|
18
18
|
import path5 from "pathe";
|
|
19
|
+
import { build as tsupBuild } from "tsup";
|
|
19
20
|
import { build, loadConfigFromFile } from "vite";
|
|
20
21
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
21
22
|
|
|
@@ -736,7 +737,8 @@ var CompilerContext = class _CompilerContext {
|
|
|
736
737
|
// miniprogram_dist
|
|
737
738
|
// miniprogram
|
|
738
739
|
// https://developers.weixin.qq.com/miniprogram/dev/devtools/npm.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E7%BB%84%E4%BB%B6%E7%9B%B8%E5%85%B3%E7%A4%BA%E4%BE%8B
|
|
739
|
-
async buildNpm() {
|
|
740
|
+
async buildNpm(options) {
|
|
741
|
+
const { sourcemap } = defu3(options, { sourcemap: true });
|
|
740
742
|
let packNpmRelationList = [];
|
|
741
743
|
if (this.projectConfig.setting?.packNpmManually && Array.isArray(this.projectConfig.setting.packNpmRelationList)) {
|
|
742
744
|
packNpmRelationList = this.projectConfig.setting.packNpmRelationList;
|
|
@@ -769,25 +771,20 @@ var CompilerContext = class _CompilerContext {
|
|
|
769
771
|
path5.join(outDir, dep)
|
|
770
772
|
);
|
|
771
773
|
} else {
|
|
772
|
-
await
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
outDir: path5.join(outDir, dep),
|
|
776
|
-
minify: false,
|
|
777
|
-
rollupOptions: {
|
|
778
|
-
input: {
|
|
779
|
-
index: require2.resolve(dep)
|
|
780
|
-
},
|
|
781
|
-
output: {
|
|
782
|
-
format: "cjs",
|
|
783
|
-
strict: false,
|
|
784
|
-
entryFileNames: "[name].js"
|
|
785
|
-
}
|
|
786
|
-
// logLevel: 'silent',
|
|
787
|
-
},
|
|
788
|
-
assetsDir: "."
|
|
774
|
+
await tsupBuild({
|
|
775
|
+
entry: {
|
|
776
|
+
index: require2.resolve(dep)
|
|
789
777
|
},
|
|
790
|
-
|
|
778
|
+
format: ["cjs"],
|
|
779
|
+
outDir: path5.join(outDir, dep),
|
|
780
|
+
silent: true,
|
|
781
|
+
shims: true,
|
|
782
|
+
outExtension: () => {
|
|
783
|
+
return {
|
|
784
|
+
js: ".js"
|
|
785
|
+
};
|
|
786
|
+
},
|
|
787
|
+
sourcemap
|
|
791
788
|
});
|
|
792
789
|
}
|
|
793
790
|
logger_default.success(`${dep} \u4F9D\u8D56\u5904\u7406\u5B8C\u6210!`);
|
package/dist/cli.cjs
CHANGED
|
@@ -27,13 +27,12 @@ var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${_
|
|
|
27
27
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
28
28
|
|
|
29
29
|
// src/cli.ts
|
|
30
|
-
var import_node_process3 = __toESM(require("process"), 1);
|
|
31
30
|
var import_init = require("@weapp-core/init");
|
|
32
31
|
var import_cac = require("cac");
|
|
33
32
|
var import_weapp_ide_cli = require("weapp-ide-cli");
|
|
34
33
|
|
|
35
34
|
// package.json
|
|
36
|
-
var version = "1.2.
|
|
35
|
+
var version = "1.2.4";
|
|
37
36
|
|
|
38
37
|
// src/constants.ts
|
|
39
38
|
var VERSION = version;
|
|
@@ -46,6 +45,7 @@ var import_shared4 = require("@weapp-core/shared");
|
|
|
46
45
|
var import_chokidar = require("chokidar");
|
|
47
46
|
var import_fs_extra4 = __toESM(require("fs-extra"), 1);
|
|
48
47
|
var import_pathe5 = __toESM(require("pathe"), 1);
|
|
48
|
+
var import_tsup = require("tsup");
|
|
49
49
|
var import_vite2 = require("vite");
|
|
50
50
|
var import_vite_tsconfig_paths = __toESM(require("vite-tsconfig-paths"), 1);
|
|
51
51
|
|
|
@@ -770,7 +770,8 @@ var CompilerContext = class _CompilerContext {
|
|
|
770
770
|
// miniprogram_dist
|
|
771
771
|
// miniprogram
|
|
772
772
|
// https://developers.weixin.qq.com/miniprogram/dev/devtools/npm.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E7%BB%84%E4%BB%B6%E7%9B%B8%E5%85%B3%E7%A4%BA%E4%BE%8B
|
|
773
|
-
async buildNpm() {
|
|
773
|
+
async buildNpm(options) {
|
|
774
|
+
const { sourcemap } = (0, import_shared4.defu)(options, { sourcemap: true });
|
|
774
775
|
let packNpmRelationList = [];
|
|
775
776
|
if (this.projectConfig.setting?.packNpmManually && Array.isArray(this.projectConfig.setting.packNpmRelationList)) {
|
|
776
777
|
packNpmRelationList = this.projectConfig.setting.packNpmRelationList;
|
|
@@ -803,25 +804,20 @@ var CompilerContext = class _CompilerContext {
|
|
|
803
804
|
import_pathe5.default.join(outDir, dep)
|
|
804
805
|
);
|
|
805
806
|
} else {
|
|
806
|
-
await (0,
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
outDir: import_pathe5.default.join(outDir, dep),
|
|
810
|
-
minify: false,
|
|
811
|
-
rollupOptions: {
|
|
812
|
-
input: {
|
|
813
|
-
index: require2.resolve(dep)
|
|
814
|
-
},
|
|
815
|
-
output: {
|
|
816
|
-
format: "cjs",
|
|
817
|
-
strict: false,
|
|
818
|
-
entryFileNames: "[name].js"
|
|
819
|
-
}
|
|
820
|
-
// logLevel: 'silent',
|
|
821
|
-
},
|
|
822
|
-
assetsDir: "."
|
|
807
|
+
await (0, import_tsup.build)({
|
|
808
|
+
entry: {
|
|
809
|
+
index: require2.resolve(dep)
|
|
823
810
|
},
|
|
824
|
-
|
|
811
|
+
format: ["cjs"],
|
|
812
|
+
outDir: import_pathe5.default.join(outDir, dep),
|
|
813
|
+
silent: true,
|
|
814
|
+
shims: true,
|
|
815
|
+
outExtension: () => {
|
|
816
|
+
return {
|
|
817
|
+
js: ".js"
|
|
818
|
+
};
|
|
819
|
+
},
|
|
820
|
+
sourcemap
|
|
825
821
|
});
|
|
826
822
|
}
|
|
827
823
|
logger_default.success(`${dep} \u4F9D\u8D56\u5904\u7406\u5B8C\u6210!`);
|
|
@@ -851,7 +847,7 @@ function convertBase(v) {
|
|
|
851
847
|
cli.option("-c, --config <file>", `[string] use specified config file`).option("--base <path>", `[string] public base path (default: /)`, {
|
|
852
848
|
type: [convertBase]
|
|
853
849
|
}).option("-l, --logLevel <level>", `[string] info | warn | error | silent`).option("--clearScreen", `[boolean] allow/disable clear screen when logging`).option("-d, --debug [feat]", `[string | boolean] show debug logs`).option("-f, --filter <filter>", `[string] filter debug logs`).option("-m, --mode <mode>", `[string] set env mode`);
|
|
854
|
-
cli.command("[root]", "start dev server").alias("serve").alias("dev").action(async (root, options) => {
|
|
850
|
+
cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--skipNpm", `[boolean] if skip npm build`).action(async (root, options) => {
|
|
855
851
|
filterDuplicateOptions(options);
|
|
856
852
|
const ctx = new CompilerContext({
|
|
857
853
|
cwd: root,
|
|
@@ -859,7 +855,9 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").action(asy
|
|
|
859
855
|
isDev: true
|
|
860
856
|
});
|
|
861
857
|
await ctx.loadDefaultConfig();
|
|
862
|
-
|
|
858
|
+
if (!options.skipNpm) {
|
|
859
|
+
await ctx.buildNpm();
|
|
860
|
+
}
|
|
863
861
|
await ctx.runDev();
|
|
864
862
|
});
|
|
865
863
|
cli.command("build [root]", "build for production").option("--target <target>", `[string] transpile target (default: 'modules')`).option("--outDir <dir>", `[string] output directory (default: dist)`).option(
|
|
@@ -871,7 +869,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
|
871
869
|
).option(
|
|
872
870
|
"--emptyOutDir",
|
|
873
871
|
`[boolean] force empty outDir when it's outside of root`
|
|
874
|
-
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).action(async (root, options) => {
|
|
872
|
+
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--skipNpm", `[boolean] if skip npm build`).action(async (root, options) => {
|
|
875
873
|
filterDuplicateOptions(options);
|
|
876
874
|
const ctx = new CompilerContext({
|
|
877
875
|
cwd: root,
|
|
@@ -879,7 +877,9 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
|
879
877
|
});
|
|
880
878
|
await ctx.loadDefaultConfig();
|
|
881
879
|
await ctx.runProd();
|
|
882
|
-
|
|
880
|
+
if (!options.skipNpm) {
|
|
881
|
+
await ctx.buildNpm({ sourcemap: false });
|
|
882
|
+
}
|
|
883
883
|
});
|
|
884
884
|
cli.command("init").action(() => {
|
|
885
885
|
try {
|
|
@@ -888,8 +888,6 @@ cli.command("init").action(() => {
|
|
|
888
888
|
});
|
|
889
889
|
} catch (error) {
|
|
890
890
|
logger_default.error(error);
|
|
891
|
-
} finally {
|
|
892
|
-
import_node_process3.default.exit();
|
|
893
891
|
}
|
|
894
892
|
});
|
|
895
893
|
cli.command("open").action(async () => {
|
|
@@ -897,8 +895,6 @@ cli.command("open").action(async () => {
|
|
|
897
895
|
await (0, import_weapp_ide_cli.parse)(["open", "-p"]);
|
|
898
896
|
} catch (error) {
|
|
899
897
|
logger_default.error(error);
|
|
900
|
-
} finally {
|
|
901
|
-
import_node_process3.default.exit();
|
|
902
898
|
}
|
|
903
899
|
});
|
|
904
900
|
cli.command("npm").alias("build:npm").alias("build-npm").action(async () => {
|
|
@@ -906,8 +902,6 @@ cli.command("npm").alias("build:npm").alias("build-npm").action(async () => {
|
|
|
906
902
|
await (0, import_weapp_ide_cli.parse)(["build-npm", "-p"]);
|
|
907
903
|
} catch (error) {
|
|
908
904
|
logger_default.error(error);
|
|
909
|
-
} finally {
|
|
910
|
-
import_node_process3.default.exit();
|
|
911
905
|
}
|
|
912
906
|
});
|
|
913
907
|
cli.help();
|
package/dist/cli.mjs
CHANGED
|
@@ -2,11 +2,10 @@ import {
|
|
|
2
2
|
CompilerContext,
|
|
3
3
|
VERSION,
|
|
4
4
|
logger_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-7CROAIKY.mjs";
|
|
6
6
|
import "./chunk-444MQSSG.mjs";
|
|
7
7
|
|
|
8
8
|
// src/cli.ts
|
|
9
|
-
import process from "node:process";
|
|
10
9
|
import { initConfig } from "@weapp-core/init";
|
|
11
10
|
import { cac } from "cac";
|
|
12
11
|
import { parse } from "weapp-ide-cli";
|
|
@@ -27,7 +26,7 @@ function convertBase(v) {
|
|
|
27
26
|
cli.option("-c, --config <file>", `[string] use specified config file`).option("--base <path>", `[string] public base path (default: /)`, {
|
|
28
27
|
type: [convertBase]
|
|
29
28
|
}).option("-l, --logLevel <level>", `[string] info | warn | error | silent`).option("--clearScreen", `[boolean] allow/disable clear screen when logging`).option("-d, --debug [feat]", `[string | boolean] show debug logs`).option("-f, --filter <filter>", `[string] filter debug logs`).option("-m, --mode <mode>", `[string] set env mode`);
|
|
30
|
-
cli.command("[root]", "start dev server").alias("serve").alias("dev").action(async (root, options) => {
|
|
29
|
+
cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--skipNpm", `[boolean] if skip npm build`).action(async (root, options) => {
|
|
31
30
|
filterDuplicateOptions(options);
|
|
32
31
|
const ctx = new CompilerContext({
|
|
33
32
|
cwd: root,
|
|
@@ -35,7 +34,9 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").action(asy
|
|
|
35
34
|
isDev: true
|
|
36
35
|
});
|
|
37
36
|
await ctx.loadDefaultConfig();
|
|
38
|
-
|
|
37
|
+
if (!options.skipNpm) {
|
|
38
|
+
await ctx.buildNpm();
|
|
39
|
+
}
|
|
39
40
|
await ctx.runDev();
|
|
40
41
|
});
|
|
41
42
|
cli.command("build [root]", "build for production").option("--target <target>", `[string] transpile target (default: 'modules')`).option("--outDir <dir>", `[string] output directory (default: dist)`).option(
|
|
@@ -47,7 +48,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
|
47
48
|
).option(
|
|
48
49
|
"--emptyOutDir",
|
|
49
50
|
`[boolean] force empty outDir when it's outside of root`
|
|
50
|
-
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).action(async (root, options) => {
|
|
51
|
+
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--skipNpm", `[boolean] if skip npm build`).action(async (root, options) => {
|
|
51
52
|
filterDuplicateOptions(options);
|
|
52
53
|
const ctx = new CompilerContext({
|
|
53
54
|
cwd: root,
|
|
@@ -55,7 +56,9 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
|
55
56
|
});
|
|
56
57
|
await ctx.loadDefaultConfig();
|
|
57
58
|
await ctx.runProd();
|
|
58
|
-
|
|
59
|
+
if (!options.skipNpm) {
|
|
60
|
+
await ctx.buildNpm({ sourcemap: false });
|
|
61
|
+
}
|
|
59
62
|
});
|
|
60
63
|
cli.command("init").action(() => {
|
|
61
64
|
try {
|
|
@@ -64,8 +67,6 @@ cli.command("init").action(() => {
|
|
|
64
67
|
});
|
|
65
68
|
} catch (error) {
|
|
66
69
|
logger_default.error(error);
|
|
67
|
-
} finally {
|
|
68
|
-
process.exit();
|
|
69
70
|
}
|
|
70
71
|
});
|
|
71
72
|
cli.command("open").action(async () => {
|
|
@@ -73,8 +74,6 @@ cli.command("open").action(async () => {
|
|
|
73
74
|
await parse(["open", "-p"]);
|
|
74
75
|
} catch (error) {
|
|
75
76
|
logger_default.error(error);
|
|
76
|
-
} finally {
|
|
77
|
-
process.exit();
|
|
78
77
|
}
|
|
79
78
|
});
|
|
80
79
|
cli.command("npm").alias("build:npm").alias("build-npm").action(async () => {
|
|
@@ -82,8 +81,6 @@ cli.command("npm").alias("build:npm").alias("build-npm").action(async () => {
|
|
|
82
81
|
await parse(["build-npm", "-p"]);
|
|
83
82
|
} catch (error) {
|
|
84
83
|
logger_default.error(error);
|
|
85
|
-
} finally {
|
|
86
|
-
process.exit();
|
|
87
84
|
}
|
|
88
85
|
});
|
|
89
86
|
cli.help();
|
package/dist/index.cjs
CHANGED
|
@@ -45,6 +45,7 @@ var import_shared4 = require("@weapp-core/shared");
|
|
|
45
45
|
var import_chokidar = require("chokidar");
|
|
46
46
|
var import_fs_extra4 = __toESM(require("fs-extra"), 1);
|
|
47
47
|
var import_pathe5 = __toESM(require("pathe"), 1);
|
|
48
|
+
var import_tsup = require("tsup");
|
|
48
49
|
var import_vite2 = require("vite");
|
|
49
50
|
var import_vite_tsconfig_paths = __toESM(require("vite-tsconfig-paths"), 1);
|
|
50
51
|
|
|
@@ -772,7 +773,8 @@ var CompilerContext = class _CompilerContext {
|
|
|
772
773
|
// miniprogram_dist
|
|
773
774
|
// miniprogram
|
|
774
775
|
// https://developers.weixin.qq.com/miniprogram/dev/devtools/npm.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E7%BB%84%E4%BB%B6%E7%9B%B8%E5%85%B3%E7%A4%BA%E4%BE%8B
|
|
775
|
-
async buildNpm() {
|
|
776
|
+
async buildNpm(options) {
|
|
777
|
+
const { sourcemap } = (0, import_shared4.defu)(options, { sourcemap: true });
|
|
776
778
|
let packNpmRelationList = [];
|
|
777
779
|
if (this.projectConfig.setting?.packNpmManually && Array.isArray(this.projectConfig.setting.packNpmRelationList)) {
|
|
778
780
|
packNpmRelationList = this.projectConfig.setting.packNpmRelationList;
|
|
@@ -805,25 +807,20 @@ var CompilerContext = class _CompilerContext {
|
|
|
805
807
|
import_pathe5.default.join(outDir, dep)
|
|
806
808
|
);
|
|
807
809
|
} else {
|
|
808
|
-
await (0,
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
outDir: import_pathe5.default.join(outDir, dep),
|
|
812
|
-
minify: false,
|
|
813
|
-
rollupOptions: {
|
|
814
|
-
input: {
|
|
815
|
-
index: require2.resolve(dep)
|
|
816
|
-
},
|
|
817
|
-
output: {
|
|
818
|
-
format: "cjs",
|
|
819
|
-
strict: false,
|
|
820
|
-
entryFileNames: "[name].js"
|
|
821
|
-
}
|
|
822
|
-
// logLevel: 'silent',
|
|
823
|
-
},
|
|
824
|
-
assetsDir: "."
|
|
810
|
+
await (0, import_tsup.build)({
|
|
811
|
+
entry: {
|
|
812
|
+
index: require2.resolve(dep)
|
|
825
813
|
},
|
|
826
|
-
|
|
814
|
+
format: ["cjs"],
|
|
815
|
+
outDir: import_pathe5.default.join(outDir, dep),
|
|
816
|
+
silent: true,
|
|
817
|
+
shims: true,
|
|
818
|
+
outExtension: () => {
|
|
819
|
+
return {
|
|
820
|
+
js: ".js"
|
|
821
|
+
};
|
|
822
|
+
},
|
|
823
|
+
sourcemap
|
|
827
824
|
});
|
|
828
825
|
}
|
|
829
826
|
logger_default.success(`${dep} \u4F9D\u8D56\u5904\u7406\u5B8C\u6210!`);
|
package/dist/index.d.cts
CHANGED
|
@@ -48,7 +48,9 @@ declare class CompilerContext {
|
|
|
48
48
|
runProd(): Promise<RollupOutput | RollupOutput[] | undefined>;
|
|
49
49
|
build(): Promise<FSWatcher | undefined> | Promise<RollupOutput | RollupOutput[] | undefined>;
|
|
50
50
|
loadDefaultConfig(): Promise<void>;
|
|
51
|
-
buildNpm(
|
|
51
|
+
buildNpm(options?: {
|
|
52
|
+
sourcemap?: boolean;
|
|
53
|
+
}): Promise<void>;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
export { CompilerContext, type CompilerContextOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -48,7 +48,9 @@ declare class CompilerContext {
|
|
|
48
48
|
runProd(): Promise<RollupOutput | RollupOutput[] | undefined>;
|
|
49
49
|
build(): Promise<FSWatcher | undefined> | Promise<RollupOutput | RollupOutput[] | undefined>;
|
|
50
50
|
loadDefaultConfig(): Promise<void>;
|
|
51
|
-
buildNpm(
|
|
51
|
+
buildNpm(options?: {
|
|
52
|
+
sourcemap?: boolean;
|
|
53
|
+
}): Promise<void>;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
export { CompilerContext, type CompilerContextOptions };
|
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.4",
|
|
5
5
|
"description": "weapp-vite 一个现代化的小程序打包工具",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -62,11 +62,12 @@
|
|
|
62
62
|
"pathe": "^1.1.2",
|
|
63
63
|
"picocolors": "^1.1.0",
|
|
64
64
|
"pkg-types": "^1.2.0",
|
|
65
|
+
"tsup": "^8.3.0",
|
|
65
66
|
"vite-tsconfig-paths": "^5.0.1",
|
|
66
67
|
"@weapp-core/init": "^1.0.4",
|
|
67
68
|
"@weapp-core/logger": "^1.0.1",
|
|
68
|
-
"
|
|
69
|
-
"weapp-
|
|
69
|
+
"weapp-ide-cli": "^2.0.6",
|
|
70
|
+
"@weapp-core/shared": "^1.0.1"
|
|
70
71
|
},
|
|
71
72
|
"publishConfig": {
|
|
72
73
|
"access": "public",
|