weapp-vite 5.2.3 → 5.4.0
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/client.d.ts +17 -3
- package/dist/auto-import-components/resolvers.cjs +6 -2
- package/dist/auto-import-components/resolvers.d.cts +2 -2
- package/dist/auto-import-components/resolvers.d.ts +2 -2
- package/dist/auto-import-components/resolvers.mjs +6 -2
- package/dist/auto-routes.cjs +51 -0
- package/dist/auto-routes.d.cts +10 -0
- package/dist/auto-routes.d.ts +8 -0
- package/dist/auto-routes.mjs +51 -0
- package/dist/chunk-KW3QAG67.mjs +33 -0
- package/dist/chunk-LX2OMRQ4.cjs +33 -0
- package/dist/{chunk-UTHLNBNC.mjs → chunk-UT7K35VH.mjs} +3012 -814
- package/dist/{chunk-GMCAZZQY.cjs → chunk-XEHEGODS.cjs} +3014 -816
- package/dist/cli.cjs +220 -45
- package/dist/cli.mjs +209 -34
- package/dist/{config-CEyL0Mum.d.cts → config-DNP6NeTc.d.cts} +147 -5
- package/dist/{config-9I2A4BU9.d.ts → config-jhY9Idrt.d.ts} +147 -5
- package/dist/config.d.cts +4 -2
- package/dist/config.d.ts +4 -2
- package/dist/index.cjs +3 -2
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.mjs +2 -1
- package/dist/json.d.cts +5 -3
- package/dist/json.d.ts +5 -3
- package/dist/routes-C9hKJjXs.d.cts +11 -0
- package/dist/routes-C9hKJjXs.d.ts +11 -0
- package/dist/{types-D7SAXpSN.d.cts → types-g_G_na7r.d.cts} +8 -2
- package/dist/{types-D7SAXpSN.d.ts → types-g_G_na7r.d.ts} +8 -2
- package/dist/types.cjs +3 -0
- package/dist/types.d.cts +4 -10
- package/dist/types.d.ts +4 -10
- package/dist/types.mjs +3 -0
- package/package.json +19 -13
package/dist/cli.cjs
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
+
var _chunkLX2OMRQ4cjs = require('./chunk-LX2OMRQ4.cjs');
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkXEHEGODScjs = require('./chunk-XEHEGODS.cjs');
|
|
7
13
|
|
|
8
14
|
|
|
9
15
|
var _chunkOS76JPG2cjs = require('./chunk-OS76JPG2.cjs');
|
|
@@ -12,6 +18,7 @@ var _chunkOS76JPG2cjs = require('./chunk-OS76JPG2.cjs');
|
|
|
12
18
|
_chunkOS76JPG2cjs.init_cjs_shims.call(void 0, );
|
|
13
19
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
14
20
|
var _init = require('@weapp-core/init');
|
|
21
|
+
var _shared = require('@weapp-core/shared');
|
|
15
22
|
|
|
16
23
|
// ../../node_modules/.pnpm/cac@6.7.14/node_modules/cac/dist/index.mjs
|
|
17
24
|
_chunkOS76JPG2cjs.init_cjs_shims.call(void 0, );
|
|
@@ -599,7 +606,7 @@ var CAC = class extends _events.EventEmitter {
|
|
|
599
606
|
};
|
|
600
607
|
var cac = (name = "") => new CAC(name);
|
|
601
608
|
|
|
602
|
-
// ../../node_modules/.pnpm/package-manager-detector@1.4.
|
|
609
|
+
// ../../node_modules/.pnpm/package-manager-detector@1.4.1/node_modules/package-manager-detector/dist/commands.mjs
|
|
603
610
|
_chunkOS76JPG2cjs.init_cjs_shims.call(void 0, );
|
|
604
611
|
function dashDashArg(agent, agentCommand) {
|
|
605
612
|
return (args) => {
|
|
@@ -676,7 +683,7 @@ var bun = {
|
|
|
676
683
|
"global": ["bun", "add", "-g", 0],
|
|
677
684
|
"add": ["bun", "add", 0],
|
|
678
685
|
"upgrade": ["bun", "update", 0],
|
|
679
|
-
"upgrade-interactive": ["bun", "update", 0],
|
|
686
|
+
"upgrade-interactive": ["bun", "update", "-i", 0],
|
|
680
687
|
"execute": ["bun", "x", 0],
|
|
681
688
|
"execute-local": ["bun", "x", 0],
|
|
682
689
|
"uninstall": ["bun", "remove", 0],
|
|
@@ -736,7 +743,7 @@ var _weappidecli = require('weapp-ide-cli');
|
|
|
736
743
|
_chunkOS76JPG2cjs.init_cjs_shims.call(void 0, );
|
|
737
744
|
|
|
738
745
|
var _schematics = require('@weapp-core/schematics');
|
|
739
|
-
|
|
746
|
+
|
|
740
747
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
741
748
|
|
|
742
749
|
function composePath(outDir, filename) {
|
|
@@ -804,7 +811,7 @@ async function generate(options) {
|
|
|
804
811
|
for (const { code, fileName: fileName2 } of files) {
|
|
805
812
|
if (code !== void 0) {
|
|
806
813
|
await _fsextra2.default.outputFile(_pathe2.default.resolve(basepath, fileName2), code, "utf8");
|
|
807
|
-
|
|
814
|
+
_chunkXEHEGODScjs.logger_default.success(`${composePath(outDir, fileName2)} \u521B\u5EFA\u6210\u529F\uFF01`);
|
|
808
815
|
}
|
|
809
816
|
}
|
|
810
817
|
}
|
|
@@ -842,36 +849,110 @@ async function readTemplateFile(templatePath, context) {
|
|
|
842
849
|
// src/cli.ts
|
|
843
850
|
var cli = cac("weapp-vite");
|
|
844
851
|
try {
|
|
845
|
-
|
|
852
|
+
_chunkXEHEGODScjs.checkRuntime.call(void 0, {
|
|
846
853
|
bun: "0.0.0",
|
|
847
854
|
deno: "0.0.0",
|
|
848
855
|
node: "20.19.0"
|
|
849
856
|
});
|
|
850
857
|
} catch (e) {
|
|
851
858
|
}
|
|
852
|
-
function loadConfig(configFile) {
|
|
853
|
-
|
|
859
|
+
async function loadConfig(configFile) {
|
|
860
|
+
const cwd = _process2.default.cwd();
|
|
861
|
+
let resolvedConfigFile = configFile;
|
|
862
|
+
if (resolvedConfigFile && !_pathe2.default.isAbsolute(resolvedConfigFile)) {
|
|
863
|
+
resolvedConfigFile = _pathe2.default.resolve(cwd, resolvedConfigFile);
|
|
864
|
+
}
|
|
865
|
+
const configEnv = {
|
|
854
866
|
command: "serve",
|
|
855
867
|
mode: "development"
|
|
856
|
-
}
|
|
868
|
+
};
|
|
869
|
+
const loaded = await _vite.loadConfigFromFile.call(void 0, configEnv, resolvedConfigFile, cwd);
|
|
870
|
+
const weappConfigFilePath = await _chunkXEHEGODScjs.resolveWeappConfigFile.call(void 0, {
|
|
871
|
+
root: cwd,
|
|
872
|
+
specified: resolvedConfigFile
|
|
873
|
+
});
|
|
874
|
+
let weappLoaded;
|
|
875
|
+
if (weappConfigFilePath) {
|
|
876
|
+
const normalizedWeappPath = _pathe2.default.resolve(weappConfigFilePath);
|
|
877
|
+
const normalizedLoadedPath = _optionalChain([loaded, 'optionalAccess', _6 => _6.path]) ? _pathe2.default.resolve(loaded.path) : void 0;
|
|
878
|
+
if (normalizedLoadedPath && normalizedLoadedPath === normalizedWeappPath) {
|
|
879
|
+
weappLoaded = loaded;
|
|
880
|
+
} else {
|
|
881
|
+
weappLoaded = await _vite.loadConfigFromFile.call(void 0, configEnv, weappConfigFilePath, cwd);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
if (!loaded && !weappLoaded) {
|
|
885
|
+
return void 0;
|
|
886
|
+
}
|
|
887
|
+
const config = _nullishCoalesce(_optionalChain([loaded, 'optionalAccess', _7 => _7.config]), () => ( (_nullishCoalesce(_optionalChain([weappLoaded, 'optionalAccess', _8 => _8.config]), () => ( {})))));
|
|
888
|
+
if (_optionalChain([weappLoaded, 'optionalAccess', _9 => _9.config, 'optionalAccess', _10 => _10.weapp])) {
|
|
889
|
+
config.weapp = _shared.defu.call(void 0,
|
|
890
|
+
weappLoaded.config.weapp,
|
|
891
|
+
_nullishCoalesce(config.weapp, () => ( {}))
|
|
892
|
+
);
|
|
893
|
+
}
|
|
894
|
+
const dependencySet = /* @__PURE__ */ new Set();
|
|
895
|
+
for (const dependency of _nullishCoalesce(_optionalChain([loaded, 'optionalAccess', _11 => _11.dependencies]), () => ( []))) {
|
|
896
|
+
dependencySet.add(dependency);
|
|
897
|
+
}
|
|
898
|
+
for (const dependency of _nullishCoalesce(_optionalChain([weappLoaded, 'optionalAccess', _12 => _12.dependencies]), () => ( []))) {
|
|
899
|
+
dependencySet.add(dependency);
|
|
900
|
+
}
|
|
901
|
+
return {
|
|
902
|
+
config,
|
|
903
|
+
path: _nullishCoalesce(_nullishCoalesce(_optionalChain([weappLoaded, 'optionalAccess', _13 => _13.path]), () => ( _optionalChain([loaded, 'optionalAccess', _14 => _14.path]))), () => ( resolvedConfigFile)),
|
|
904
|
+
dependencies: Array.from(dependencySet)
|
|
905
|
+
};
|
|
857
906
|
}
|
|
858
907
|
var logBuildAppFinishOnlyShowOnce = false;
|
|
859
|
-
function logBuildAppFinish(configService) {
|
|
860
|
-
if (
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
908
|
+
function logBuildAppFinish(configService, webServer, options = {}) {
|
|
909
|
+
if (logBuildAppFinishOnlyShowOnce) {
|
|
910
|
+
return;
|
|
911
|
+
}
|
|
912
|
+
const { skipMini = false, skipWeb = false } = options;
|
|
913
|
+
if (skipMini) {
|
|
914
|
+
if (webServer) {
|
|
915
|
+
const urls = webServer.resolvedUrls;
|
|
916
|
+
const candidates = urls ? [..._nullishCoalesce(urls.local, () => ( [])), ..._nullishCoalesce(urls.network, () => ( []))] : [];
|
|
917
|
+
if (candidates.length > 0) {
|
|
918
|
+
_chunkXEHEGODScjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8\uFF0C\u6D4F\u89C8\u5668\u8BBF\u95EE\uFF1A");
|
|
919
|
+
for (const url of candidates) {
|
|
920
|
+
_chunkXEHEGODScjs.logger_default.info(` \u279C ${url}`);
|
|
921
|
+
}
|
|
922
|
+
} else {
|
|
923
|
+
_chunkXEHEGODScjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
|
|
924
|
+
}
|
|
925
|
+
} else {
|
|
926
|
+
_chunkXEHEGODScjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
|
|
927
|
+
}
|
|
873
928
|
logBuildAppFinishOnlyShowOnce = true;
|
|
929
|
+
return;
|
|
874
930
|
}
|
|
931
|
+
const { command, args } = _nullishCoalesce(resolveCommand(
|
|
932
|
+
configService.packageManager.agent,
|
|
933
|
+
"run",
|
|
934
|
+
["open"]
|
|
935
|
+
), () => ( {
|
|
936
|
+
command: "npm",
|
|
937
|
+
args: ["run", "open"]
|
|
938
|
+
}));
|
|
939
|
+
const devCommand = `${command} ${args.join(" ")}`;
|
|
940
|
+
_chunkXEHEGODScjs.logger_default.success("\u5E94\u7528\u6784\u5EFA\u5B8C\u6210\uFF01\u9884\u89C8\u65B9\u5F0F ( `2` \u79CD\u9009\u5176\u4E00\u5373\u53EF)\uFF1A");
|
|
941
|
+
_chunkXEHEGODScjs.logger_default.info(`\u6267\u884C \`${devCommand}\` \u53EF\u4EE5\u76F4\u63A5\u5728 \`\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\` \u91CC\u6253\u5F00\u5F53\u524D\u5E94\u7528`);
|
|
942
|
+
_chunkXEHEGODScjs.logger_default.info("\u6216\u624B\u52A8\u6253\u5F00\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\uFF0C\u5BFC\u5165\u6839\u76EE\u5F55(`project.config.json` \u6587\u4EF6\u6240\u5728\u7684\u76EE\u5F55)\uFF0C\u5373\u53EF\u9884\u89C8\u6548\u679C");
|
|
943
|
+
if (!skipWeb && webServer) {
|
|
944
|
+
const urls = webServer.resolvedUrls;
|
|
945
|
+
const candidates = urls ? [..._nullishCoalesce(urls.local, () => ( [])), ..._nullishCoalesce(urls.network, () => ( []))] : [];
|
|
946
|
+
if (candidates.length > 0) {
|
|
947
|
+
_chunkXEHEGODScjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8\uFF0C\u6D4F\u89C8\u5668\u8BBF\u95EE\uFF1A");
|
|
948
|
+
for (const url of candidates) {
|
|
949
|
+
_chunkXEHEGODScjs.logger_default.info(` \u279C ${url}`);
|
|
950
|
+
}
|
|
951
|
+
} else {
|
|
952
|
+
_chunkXEHEGODScjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
logBuildAppFinishOnlyShowOnce = true;
|
|
875
956
|
}
|
|
876
957
|
function filterDuplicateOptions(options) {
|
|
877
958
|
for (const [key, value] of Object.entries(options)) {
|
|
@@ -898,28 +979,104 @@ async function openIde() {
|
|
|
898
979
|
try {
|
|
899
980
|
await _weappidecli.parse.call(void 0, ["open", "-p"]);
|
|
900
981
|
} catch (error) {
|
|
901
|
-
|
|
982
|
+
_chunkXEHEGODScjs.logger_default.error(error);
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
function logRuntimeTarget(targets) {
|
|
986
|
+
_chunkXEHEGODScjs.logger_default.info(`\u76EE\u6807\u5E73\u53F0\uFF1A${targets.label}`);
|
|
987
|
+
}
|
|
988
|
+
function resolveRuntimeTargets(options) {
|
|
989
|
+
const rawPlatform = typeof options.platform === "string" ? options.platform : typeof options.p === "string" ? options.p : void 0;
|
|
990
|
+
if (!rawPlatform) {
|
|
991
|
+
return {
|
|
992
|
+
runMini: true,
|
|
993
|
+
runWeb: false,
|
|
994
|
+
mpPlatform: _chunkXEHEGODScjs.DEFAULT_MP_PLATFORM,
|
|
995
|
+
label: _chunkXEHEGODScjs.DEFAULT_MP_PLATFORM
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
const normalized = _chunkXEHEGODScjs.normalizeMiniPlatform.call(void 0, rawPlatform);
|
|
999
|
+
if (!normalized) {
|
|
1000
|
+
return {
|
|
1001
|
+
runMini: true,
|
|
1002
|
+
runWeb: false,
|
|
1003
|
+
mpPlatform: _chunkXEHEGODScjs.DEFAULT_MP_PLATFORM,
|
|
1004
|
+
label: _chunkXEHEGODScjs.DEFAULT_MP_PLATFORM
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
if (normalized === "h5" || normalized === "web") {
|
|
1008
|
+
return {
|
|
1009
|
+
runMini: false,
|
|
1010
|
+
runWeb: true,
|
|
1011
|
+
mpPlatform: void 0,
|
|
1012
|
+
label: normalized === "h5" ? "h5" : "web"
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
const mpPlatform = _chunkXEHEGODScjs.resolveMiniPlatform.call(void 0, normalized);
|
|
1016
|
+
if (mpPlatform) {
|
|
1017
|
+
return {
|
|
1018
|
+
runMini: true,
|
|
1019
|
+
runWeb: false,
|
|
1020
|
+
mpPlatform,
|
|
1021
|
+
label: mpPlatform
|
|
1022
|
+
};
|
|
902
1023
|
}
|
|
1024
|
+
_chunkXEHEGODScjs.logger_default.warn(`\u672A\u8BC6\u522B\u7684\u5E73\u53F0 "${rawPlatform}"\uFF0C\u5DF2\u56DE\u9000\u5230 ${_chunkXEHEGODScjs.DEFAULT_MP_PLATFORM}`);
|
|
1025
|
+
return {
|
|
1026
|
+
runMini: true,
|
|
1027
|
+
runWeb: false,
|
|
1028
|
+
mpPlatform: _chunkXEHEGODScjs.DEFAULT_MP_PLATFORM,
|
|
1029
|
+
label: _chunkXEHEGODScjs.DEFAULT_MP_PLATFORM
|
|
1030
|
+
};
|
|
1031
|
+
}
|
|
1032
|
+
function createInlineConfig(mpPlatform) {
|
|
1033
|
+
if (!mpPlatform) {
|
|
1034
|
+
return void 0;
|
|
1035
|
+
}
|
|
1036
|
+
return {
|
|
1037
|
+
weapp: {
|
|
1038
|
+
platform: mpPlatform
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
903
1041
|
}
|
|
904
1042
|
cli.option("-c, --config <file>", `[string] use specified config file`).option("--base <path>", `[string] public base path (default: /)`, {
|
|
905
1043
|
type: [convertBase]
|
|
906
1044
|
}).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`);
|
|
907
|
-
cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--skipNpm", `[boolean] if skip npm build`).option("-o, --open", `[boolean] open ide`).action(async (root, options) => {
|
|
1045
|
+
cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--skipNpm", `[boolean] if skip npm build`).option("-o, --open", `[boolean] open ide`).option("-p, --platform <platform>", `[string] target platform (weapp | h5)`).action(async (root, options) => {
|
|
908
1046
|
filterDuplicateOptions(options);
|
|
909
1047
|
const configFile = resolveConfigFile(options);
|
|
910
|
-
const
|
|
1048
|
+
const targets = resolveRuntimeTargets(options);
|
|
1049
|
+
logRuntimeTarget(targets);
|
|
1050
|
+
const inlineConfig = createInlineConfig(targets.mpPlatform);
|
|
1051
|
+
const { buildService, configService, webService } = await _chunkLX2OMRQ4cjs.createCompilerContext.call(void 0, {
|
|
911
1052
|
cwd: root,
|
|
912
1053
|
mode: _nullishCoalesce(options.mode, () => ( "development")),
|
|
913
1054
|
isDev: true,
|
|
914
|
-
configFile
|
|
1055
|
+
configFile,
|
|
1056
|
+
inlineConfig
|
|
915
1057
|
});
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
1058
|
+
if (targets.runMini) {
|
|
1059
|
+
await buildService.build(options);
|
|
1060
|
+
}
|
|
1061
|
+
let webServer;
|
|
1062
|
+
if (targets.runWeb) {
|
|
1063
|
+
try {
|
|
1064
|
+
webServer = await _optionalChain([webService, 'optionalAccess', _15 => _15.startDevServer, 'call', _16 => _16()]);
|
|
1065
|
+
} catch (error) {
|
|
1066
|
+
_chunkXEHEGODScjs.logger_default.error(error);
|
|
1067
|
+
throw error;
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
if (targets.runMini) {
|
|
1071
|
+
logBuildAppFinish(configService, webServer, { skipWeb: !targets.runWeb });
|
|
1072
|
+
} else if (targets.runWeb) {
|
|
1073
|
+
logBuildAppFinish(configService, webServer, { skipMini: true });
|
|
1074
|
+
}
|
|
1075
|
+
if (options.open && targets.runMini) {
|
|
919
1076
|
await openIde();
|
|
920
1077
|
}
|
|
921
1078
|
});
|
|
922
|
-
cli.command("build [root]", "build for production").option("--target <target>", `[string] transpile target (default: 'modules')`).option("--outDir <dir>", `[string] output directory (default: dist)`).option(
|
|
1079
|
+
cli.command("build [root]", "build for production").option("--target <target>", `[string] transpile target (default: 'modules')`).option("--outDir <dir>", `[string] output directory (default: dist)`).option("-p, --platform <platform>", `[string] target platform (weapp | h5)`).option(
|
|
923
1080
|
"--sourcemap [output]",
|
|
924
1081
|
`[boolean | "inline" | "hidden"] output source maps for build (default: false)`
|
|
925
1082
|
).option(
|
|
@@ -931,14 +1088,32 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
|
931
1088
|
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--skipNpm", `[boolean] if skip npm build`).option("-o, --open", `[boolean] open ide`).action(async (root, options) => {
|
|
932
1089
|
filterDuplicateOptions(options);
|
|
933
1090
|
const configFile = resolveConfigFile(options);
|
|
934
|
-
const
|
|
1091
|
+
const targets = resolveRuntimeTargets(options);
|
|
1092
|
+
logRuntimeTarget(targets);
|
|
1093
|
+
const inlineConfig = createInlineConfig(targets.mpPlatform);
|
|
1094
|
+
const { buildService, configService, webService } = await _chunkLX2OMRQ4cjs.createCompilerContext.call(void 0, {
|
|
935
1095
|
cwd: root,
|
|
936
1096
|
mode: _nullishCoalesce(options.mode, () => ( "production")),
|
|
937
|
-
configFile
|
|
1097
|
+
configFile,
|
|
1098
|
+
inlineConfig
|
|
938
1099
|
});
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
1100
|
+
if (targets.runMini) {
|
|
1101
|
+
await buildService.build(options);
|
|
1102
|
+
}
|
|
1103
|
+
const webConfig = configService.weappWebConfig;
|
|
1104
|
+
if (targets.runWeb && _optionalChain([webConfig, 'optionalAccess', _17 => _17.enabled])) {
|
|
1105
|
+
try {
|
|
1106
|
+
await _optionalChain([webService, 'optionalAccess', _18 => _18.build, 'call', _19 => _19()]);
|
|
1107
|
+
_chunkXEHEGODScjs.logger_default.success(`Web \u6784\u5EFA\u5B8C\u6210\uFF0C\u8F93\u51FA\u76EE\u5F55\uFF1A${configService.relativeCwd(webConfig.outDir)}`);
|
|
1108
|
+
} catch (error) {
|
|
1109
|
+
_chunkXEHEGODScjs.logger_default.error(error);
|
|
1110
|
+
throw error;
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
if (targets.runMini) {
|
|
1114
|
+
logBuildAppFinish(configService, void 0, { skipWeb: !targets.runWeb });
|
|
1115
|
+
}
|
|
1116
|
+
if (options.open && targets.runMini) {
|
|
942
1117
|
await openIde();
|
|
943
1118
|
}
|
|
944
1119
|
});
|
|
@@ -948,7 +1123,7 @@ cli.command("init").action(async () => {
|
|
|
948
1123
|
command: "weapp-vite"
|
|
949
1124
|
});
|
|
950
1125
|
} catch (error) {
|
|
951
|
-
|
|
1126
|
+
_chunkXEHEGODScjs.logger_default.error(error);
|
|
952
1127
|
}
|
|
953
1128
|
});
|
|
954
1129
|
cli.command("open").action(async () => {
|
|
@@ -958,7 +1133,7 @@ cli.command("npm").alias("build:npm").alias("build-npm").action(async () => {
|
|
|
958
1133
|
try {
|
|
959
1134
|
await _weappidecli.parse.call(void 0, ["build-npm", "-p"]);
|
|
960
1135
|
} catch (error) {
|
|
961
|
-
|
|
1136
|
+
_chunkXEHEGODScjs.logger_default.error(error);
|
|
962
1137
|
}
|
|
963
1138
|
});
|
|
964
1139
|
cli.command("g [filepath]", "generate component").alias("generate").option("-a, --app", "type app").option("-p, --page", "type app").option("-n, --name <name>", "filename").action(async (filepath, options) => {
|
|
@@ -973,25 +1148,25 @@ cli.command("g [filepath]", "generate component").alias("generate").option("-a,
|
|
|
973
1148
|
fileName = "app";
|
|
974
1149
|
}
|
|
975
1150
|
if (filepath === void 0) {
|
|
976
|
-
|
|
1151
|
+
_chunkXEHEGODScjs.logger_default.error("weapp-vite generate <outDir> \u547D\u4EE4\u5FC5\u987B\u4F20\u5165\u8DEF\u5F84\u53C2\u6570 outDir");
|
|
977
1152
|
return;
|
|
978
1153
|
}
|
|
979
1154
|
if (options.page) {
|
|
980
1155
|
type = "page";
|
|
981
1156
|
}
|
|
982
|
-
const generateOptions = _optionalChain([config, 'optionalAccess',
|
|
983
|
-
fileName = _nullishCoalesce(_optionalChain([generateOptions, 'optionalAccess',
|
|
1157
|
+
const generateOptions = _optionalChain([config, 'optionalAccess', _20 => _20.config, 'access', _21 => _21.weapp, 'optionalAccess', _22 => _22.generate]);
|
|
1158
|
+
fileName = _nullishCoalesce(_optionalChain([generateOptions, 'optionalAccess', _23 => _23.filenames, 'optionalAccess', _24 => _24[type]]), () => ( fileName));
|
|
984
1159
|
await generate({
|
|
985
|
-
outDir: _pathe2.default.join(_nullishCoalesce(_optionalChain([generateOptions, 'optionalAccess',
|
|
1160
|
+
outDir: _pathe2.default.join(_nullishCoalesce(_optionalChain([generateOptions, 'optionalAccess', _25 => _25.dirs, 'optionalAccess', _26 => _26[type]]), () => ( "")), filepath),
|
|
986
1161
|
type,
|
|
987
1162
|
fileName,
|
|
988
|
-
extensions: _optionalChain([generateOptions, 'optionalAccess',
|
|
989
|
-
templates: _optionalChain([generateOptions, 'optionalAccess',
|
|
1163
|
+
extensions: _optionalChain([generateOptions, 'optionalAccess', _27 => _27.extensions]),
|
|
1164
|
+
templates: _optionalChain([generateOptions, 'optionalAccess', _28 => _28.templates])
|
|
990
1165
|
});
|
|
991
1166
|
});
|
|
992
1167
|
cli.command("create [outDir]", "create project").option("-t, --template <type>", "template type").action(async (outDir, options) => {
|
|
993
1168
|
await _init.createProject.call(void 0, outDir, options.template);
|
|
994
1169
|
});
|
|
995
1170
|
cli.help();
|
|
996
|
-
cli.version(
|
|
1171
|
+
cli.version(_chunkXEHEGODScjs.VERSION);
|
|
997
1172
|
cli.parse();
|