weapp-vite 5.12.0 → 6.0.0-alpha.1
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/README.md +60 -2
- package/dist/auto-import-components/resolvers.cjs +6 -6
- package/dist/auto-import-components/resolvers.mjs +1 -1
- package/dist/auto-routes.cjs +9 -8
- package/dist/auto-routes.mjs +5 -4
- package/dist/{chunk-TS7WK45E.mjs → chunk-4P5KX3LT.mjs} +2736 -2346
- package/dist/{chunk-MDUMD5GP.mjs → chunk-5CBZRYDL.mjs} +1 -8
- package/dist/{chunk-INJNZ3X2.cjs → chunk-E34K6TPD.cjs} +2 -2
- package/dist/{chunk-ANDG4OME.cjs → chunk-EL4WI75Z.cjs} +2746 -2356
- package/dist/{chunk-7DRE4BEK.cjs → chunk-FB7KR7SH.cjs} +6 -6
- package/dist/chunk-IEICAJDZ.cjs +188 -0
- package/dist/chunk-MK4LDVBT.mjs +188 -0
- package/dist/{chunk-7KGGMLZZ.mjs → chunk-ML5KPLC5.mjs} +1 -1
- package/dist/{chunk-IVFT4TLR.mjs → chunk-O6633IWP.mjs} +1 -1
- package/dist/{chunk-MTUYQJIF.cjs → chunk-SJSLFDTA.cjs} +2 -2
- package/dist/{chunk-N5FVU7GR.cjs → chunk-TZGJRA2Y.cjs} +2 -9
- package/dist/chunk-UKTIE44Q.cjs +34 -0
- package/dist/{chunk-LLYDSPS7.mjs → chunk-VKLSO3EM.mjs} +2 -2
- package/dist/chunk-WYYIFHJZ.cjs +6 -0
- package/dist/chunk-YIVKT2UN.mjs +34 -0
- package/dist/{chunk-46VA2TEF.mjs → chunk-YXFADQPY.mjs} +1 -1
- package/dist/cli.cjs +117 -92
- package/dist/cli.mjs +33 -8
- package/dist/{config-sFIhUM69.d.ts → config-B6T_L15M.d.ts} +29 -0
- package/dist/{config-DgMm7Geo.d.cts → config-D5ATg2Pv.d.cts} +29 -0
- package/dist/config.cjs +4 -4
- package/dist/config.d.cts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.mjs +3 -3
- package/dist/file-KXULPGWG.mjs +29 -0
- package/dist/file-S6QIP4VW.cjs +29 -0
- package/dist/index.cjs +18 -9
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.mjs +15 -6
- package/dist/json.cjs +3 -3
- package/dist/json.d.cts +1 -1
- package/dist/json.d.ts +1 -1
- package/dist/json.mjs +2 -2
- package/dist/runtime.cjs +11 -0
- package/dist/runtime.d.cts +29 -0
- package/dist/runtime.d.ts +29 -0
- package/dist/runtime.mjs +11 -0
- package/dist/types.cjs +9 -9
- package/dist/types.d.cts +2 -1
- package/dist/types.d.ts +2 -1
- package/dist/types.mjs +2 -2
- package/dist/volar.cjs +2 -2
- package/dist/volar.mjs +1 -1
- package/package.json +18 -11
- package/dist/chunk-2KCQ5UBK.cjs +0 -6
package/dist/cli.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await 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
|
|
3
|
+
var _chunkFB7KR7SHcjs = require('./chunk-FB7KR7SH.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -10,18 +10,20 @@ var _chunk7DRE4BEKcjs = require('./chunk-7DRE4BEK.cjs');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
var _chunkEL4WI75Zcjs = require('./chunk-EL4WI75Z.cjs');
|
|
13
14
|
|
|
14
|
-
var _chunkANDG4OMEcjs = require('./chunk-ANDG4OME.cjs');
|
|
15
15
|
|
|
16
|
+
var _chunkIEICAJDZcjs = require('./chunk-IEICAJDZ.cjs');
|
|
16
17
|
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
|
|
20
|
+
var _chunkTZGJRA2Ycjs = require('./chunk-TZGJRA2Y.cjs');
|
|
19
21
|
|
|
20
22
|
// src/cli.ts
|
|
21
|
-
|
|
23
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
22
24
|
|
|
23
25
|
// ../../node_modules/.pnpm/cac@6.7.14/node_modules/cac/dist/index.mjs
|
|
24
|
-
|
|
26
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
25
27
|
var _events = require('events');
|
|
26
28
|
function toArr(any) {
|
|
27
29
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -607,18 +609,18 @@ var CAC = class extends _events.EventEmitter {
|
|
|
607
609
|
var cac = (name = "") => new CAC(name);
|
|
608
610
|
|
|
609
611
|
// src/cli/commands/analyze.ts
|
|
610
|
-
|
|
612
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
611
613
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
612
614
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
613
615
|
var _pathe = require('pathe'); var _pathe2 = _interopRequireDefault(_pathe);
|
|
614
616
|
|
|
615
617
|
// src/analyze/subpackages.ts
|
|
616
|
-
|
|
618
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
617
619
|
var _buffer = require('buffer');
|
|
618
620
|
|
|
619
621
|
var _vite = require('vite');
|
|
620
622
|
var VIRTUAL_MODULE_INDICATOR = "\0";
|
|
621
|
-
var VIRTUAL_PREFIX = `${
|
|
623
|
+
var VIRTUAL_PREFIX = `${_chunkEL4WI75Zcjs.SHARED_CHUNK_VIRTUAL_PREFIX}/`;
|
|
622
624
|
function isPathInside(parent, candidate) {
|
|
623
625
|
if (!parent) {
|
|
624
626
|
return false;
|
|
@@ -981,7 +983,7 @@ async function analyzeSubpackages(ctx) {
|
|
|
981
983
|
};
|
|
982
984
|
const analysisConfig = configService.merge(
|
|
983
985
|
void 0,
|
|
984
|
-
|
|
986
|
+
_chunkEL4WI75Zcjs.createSharedBuildConfig.call(void 0, configService, scanService),
|
|
985
987
|
{
|
|
986
988
|
build: {
|
|
987
989
|
write: false,
|
|
@@ -1009,13 +1011,13 @@ async function analyzeSubpackages(ctx) {
|
|
|
1009
1011
|
}
|
|
1010
1012
|
|
|
1011
1013
|
// src/cli/analyze/dashboard.ts
|
|
1012
|
-
|
|
1014
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
1013
1015
|
|
|
1014
1016
|
|
|
1015
1017
|
|
|
1016
1018
|
|
|
1017
1019
|
// src/packagePaths.ts
|
|
1018
|
-
|
|
1020
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
1019
1021
|
var _path = require('path');
|
|
1020
1022
|
var _url = require('url');
|
|
1021
1023
|
|
|
@@ -1033,7 +1035,7 @@ function findPackageRoot(from) {
|
|
|
1033
1035
|
}
|
|
1034
1036
|
throw new Error("\u65E0\u6CD5\u5B9A\u4F4D weapp-vite \u5305\u6839\u76EE\u5F55\uFF0C\u8BF7\u68C0\u67E5\u5B89\u88C5\u8DEF\u5F84\u3002");
|
|
1035
1037
|
}
|
|
1036
|
-
var CURRENT_DIR = _path.dirname.call(void 0, _url.fileURLToPath.call(void 0,
|
|
1038
|
+
var CURRENT_DIR = _path.dirname.call(void 0, _url.fileURLToPath.call(void 0, _chunkTZGJRA2Ycjs.importMetaUrl));
|
|
1037
1039
|
var PACKAGE_ROOT = findPackageRoot(CURRENT_DIR);
|
|
1038
1040
|
var ANALYZE_DASHBOARD_ROOT = _path.join.call(void 0, PACKAGE_ROOT, "modules/analyze-dashboard");
|
|
1039
1041
|
|
|
@@ -1079,7 +1081,7 @@ async function waitForServerExit(server) {
|
|
|
1079
1081
|
try {
|
|
1080
1082
|
await server.close();
|
|
1081
1083
|
} catch (error) {
|
|
1082
|
-
|
|
1084
|
+
_chunkEL4WI75Zcjs.logger_default.error(error);
|
|
1083
1085
|
}
|
|
1084
1086
|
};
|
|
1085
1087
|
const signals = ["SIGINT", "SIGTERM"];
|
|
@@ -1157,22 +1159,22 @@ async function startAnalyzeDashboard(result, options) {
|
|
|
1157
1159
|
urls
|
|
1158
1160
|
};
|
|
1159
1161
|
if (_optionalChain([options, 'optionalAccess', _9 => _9.watch])) {
|
|
1160
|
-
|
|
1162
|
+
_chunkEL4WI75Zcjs.logger_default.info("\u5206\u6790\u4EEA\u8868\u76D8\u5DF2\u542F\u52A8\uFF08\u5B9E\u65F6\u6A21\u5F0F\uFF09\uFF0C\u6309 Ctrl+C \u9000\u51FA\u3002");
|
|
1161
1163
|
for (const url of handle.urls) {
|
|
1162
|
-
|
|
1164
|
+
_chunkEL4WI75Zcjs.logger_default.info(`\u5206\u5305\u5206\u6790\u4EEA\u8868\u76D8\uFF1A${url}`);
|
|
1163
1165
|
}
|
|
1164
1166
|
void waitPromise;
|
|
1165
1167
|
return handle;
|
|
1166
1168
|
}
|
|
1167
|
-
|
|
1169
|
+
_chunkEL4WI75Zcjs.logger_default.info("\u5206\u6790\u4EEA\u8868\u76D8\u5DF2\u542F\u52A8\uFF08\u9759\u6001\u6A21\u5F0F\uFF09\uFF0C\u6309 Ctrl+C \u9000\u51FA\u3002");
|
|
1168
1170
|
for (const url of handle.urls) {
|
|
1169
|
-
|
|
1171
|
+
_chunkEL4WI75Zcjs.logger_default.info(`\u5206\u5305\u5206\u6790\u4EEA\u8868\u76D8\uFF1A${url}`);
|
|
1170
1172
|
}
|
|
1171
1173
|
await waitPromise;
|
|
1172
1174
|
}
|
|
1173
1175
|
|
|
1174
1176
|
// src/cli/options.ts
|
|
1175
|
-
|
|
1177
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
1176
1178
|
function filterDuplicateOptions(options) {
|
|
1177
1179
|
for (const [key, value] of Object.entries(options)) {
|
|
1178
1180
|
if (Array.isArray(value)) {
|
|
@@ -1221,9 +1223,9 @@ function coerceBooleanOption(value) {
|
|
|
1221
1223
|
}
|
|
1222
1224
|
|
|
1223
1225
|
// src/cli/runtime.ts
|
|
1224
|
-
|
|
1226
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
1225
1227
|
function logRuntimeTarget(targets) {
|
|
1226
|
-
|
|
1228
|
+
_chunkEL4WI75Zcjs.logger_default.info(`\u76EE\u6807\u5E73\u53F0\uFF1A${targets.label}`);
|
|
1227
1229
|
}
|
|
1228
1230
|
function resolveRuntimeTargets(options) {
|
|
1229
1231
|
const rawPlatform = typeof options.platform === "string" ? options.platform : typeof options.p === "string" ? options.p : void 0;
|
|
@@ -1231,17 +1233,17 @@ function resolveRuntimeTargets(options) {
|
|
|
1231
1233
|
return {
|
|
1232
1234
|
runMini: true,
|
|
1233
1235
|
runWeb: false,
|
|
1234
|
-
mpPlatform:
|
|
1235
|
-
label:
|
|
1236
|
+
mpPlatform: _chunkEL4WI75Zcjs.DEFAULT_MP_PLATFORM,
|
|
1237
|
+
label: _chunkEL4WI75Zcjs.DEFAULT_MP_PLATFORM
|
|
1236
1238
|
};
|
|
1237
1239
|
}
|
|
1238
|
-
const normalized =
|
|
1240
|
+
const normalized = _chunkEL4WI75Zcjs.normalizeMiniPlatform.call(void 0, rawPlatform);
|
|
1239
1241
|
if (!normalized) {
|
|
1240
1242
|
return {
|
|
1241
1243
|
runMini: true,
|
|
1242
1244
|
runWeb: false,
|
|
1243
|
-
mpPlatform:
|
|
1244
|
-
label:
|
|
1245
|
+
mpPlatform: _chunkEL4WI75Zcjs.DEFAULT_MP_PLATFORM,
|
|
1246
|
+
label: _chunkEL4WI75Zcjs.DEFAULT_MP_PLATFORM
|
|
1245
1247
|
};
|
|
1246
1248
|
}
|
|
1247
1249
|
if (normalized === "h5" || normalized === "web") {
|
|
@@ -1252,7 +1254,7 @@ function resolveRuntimeTargets(options) {
|
|
|
1252
1254
|
label: normalized === "h5" ? "h5" : "web"
|
|
1253
1255
|
};
|
|
1254
1256
|
}
|
|
1255
|
-
const mpPlatform =
|
|
1257
|
+
const mpPlatform = _chunkEL4WI75Zcjs.resolveMiniPlatform.call(void 0, normalized);
|
|
1256
1258
|
if (mpPlatform) {
|
|
1257
1259
|
return {
|
|
1258
1260
|
runMini: true,
|
|
@@ -1261,12 +1263,12 @@ function resolveRuntimeTargets(options) {
|
|
|
1261
1263
|
label: mpPlatform
|
|
1262
1264
|
};
|
|
1263
1265
|
}
|
|
1264
|
-
|
|
1266
|
+
_chunkEL4WI75Zcjs.logger_default.warn(`\u672A\u8BC6\u522B\u7684\u5E73\u53F0 "${rawPlatform}"\uFF0C\u5DF2\u56DE\u9000\u5230 ${_chunkEL4WI75Zcjs.DEFAULT_MP_PLATFORM}`);
|
|
1265
1267
|
return {
|
|
1266
1268
|
runMini: true,
|
|
1267
1269
|
runWeb: false,
|
|
1268
|
-
mpPlatform:
|
|
1269
|
-
label:
|
|
1270
|
+
mpPlatform: _chunkEL4WI75Zcjs.DEFAULT_MP_PLATFORM,
|
|
1271
|
+
label: _chunkEL4WI75Zcjs.DEFAULT_MP_PLATFORM
|
|
1270
1272
|
};
|
|
1271
1273
|
}
|
|
1272
1274
|
function createInlineConfig(mpPlatform) {
|
|
@@ -1294,15 +1296,15 @@ function printAnalysisSummary(result) {
|
|
|
1294
1296
|
packageModuleSet.set(pkgRef.packageId, set);
|
|
1295
1297
|
}
|
|
1296
1298
|
}
|
|
1297
|
-
|
|
1299
|
+
_chunkEL4WI75Zcjs.logger_default.success("\u5206\u5305\u5206\u6790\u5B8C\u6210");
|
|
1298
1300
|
for (const pkg of result.packages) {
|
|
1299
1301
|
const chunkCount = pkg.files.filter((file) => file.type === "chunk").length;
|
|
1300
1302
|
const assetCount = pkg.files.length - chunkCount;
|
|
1301
1303
|
const moduleCount = _nullishCoalesce(_optionalChain([packageModuleSet, 'access', _10 => _10.get, 'call', _11 => _11(pkg.id), 'optionalAccess', _12 => _12.size]), () => ( 0));
|
|
1302
|
-
|
|
1304
|
+
_chunkEL4WI75Zcjs.logger_default.info(`- ${pkg.label}\uFF1A${chunkCount} \u4E2A\u6A21\u5757\u4EA7\u7269\uFF0C${assetCount} \u4E2A\u8D44\u6E90\uFF0C\u8986\u76D6 ${moduleCount} \u4E2A\u6E90\u7801\u6A21\u5757`);
|
|
1303
1305
|
}
|
|
1304
1306
|
if (result.subPackages.length > 0) {
|
|
1305
|
-
|
|
1307
|
+
_chunkEL4WI75Zcjs.logger_default.info("\u5206\u5305\u914D\u7F6E\uFF1A");
|
|
1306
1308
|
for (const descriptor of result.subPackages) {
|
|
1307
1309
|
const segments = [descriptor.root];
|
|
1308
1310
|
if (descriptor.name) {
|
|
@@ -1311,15 +1313,15 @@ function printAnalysisSummary(result) {
|
|
|
1311
1313
|
if (descriptor.independent) {
|
|
1312
1314
|
segments.push("\u72EC\u7ACB\u6784\u5EFA");
|
|
1313
1315
|
}
|
|
1314
|
-
|
|
1316
|
+
_chunkEL4WI75Zcjs.logger_default.info(`- ${segments.join("\uFF0C")}`);
|
|
1315
1317
|
}
|
|
1316
1318
|
}
|
|
1317
1319
|
const duplicates = result.modules.filter((module) => module.packages.length > 1);
|
|
1318
1320
|
if (duplicates.length === 0) {
|
|
1319
|
-
|
|
1321
|
+
_chunkEL4WI75Zcjs.logger_default.info("\u672A\u68C0\u6D4B\u5230\u8DE8\u5305\u590D\u7528\u7684\u6E90\u7801\u6A21\u5757\u3002");
|
|
1320
1322
|
return;
|
|
1321
1323
|
}
|
|
1322
|
-
|
|
1324
|
+
_chunkEL4WI75Zcjs.logger_default.info(`\u8DE8\u5305\u590D\u7528/\u590D\u5236\u6E90\u7801\u5171 ${duplicates.length} \u9879\uFF1A`);
|
|
1323
1325
|
const limit = 10;
|
|
1324
1326
|
const entries = duplicates.slice(0, limit);
|
|
1325
1327
|
for (const module of entries) {
|
|
@@ -1327,10 +1329,10 @@ function printAnalysisSummary(result) {
|
|
|
1327
1329
|
const label = _nullishCoalesce(packageLabelMap.get(pkgRef.packageId), () => ( pkgRef.packageId));
|
|
1328
1330
|
return `${label} \u2192 ${pkgRef.files.join(", ")}`;
|
|
1329
1331
|
}).join("\uFF1B");
|
|
1330
|
-
|
|
1332
|
+
_chunkEL4WI75Zcjs.logger_default.info(`- ${module.source} (${module.sourceType})\uFF1A${placements}`);
|
|
1331
1333
|
}
|
|
1332
1334
|
if (duplicates.length > limit) {
|
|
1333
|
-
|
|
1335
|
+
_chunkEL4WI75Zcjs.logger_default.info(`- \u2026\u5176\u4F59 ${duplicates.length - limit} \u9879\u8BF7\u4F7F\u7528 \`weapp-vite analyze --json\` \u67E5\u770B`);
|
|
1334
1336
|
}
|
|
1335
1337
|
}
|
|
1336
1338
|
function registerAnalyzeCommand(cli2) {
|
|
@@ -1340,15 +1342,15 @@ function registerAnalyzeCommand(cli2) {
|
|
|
1340
1342
|
const targets = resolveRuntimeTargets(options);
|
|
1341
1343
|
logRuntimeTarget(targets);
|
|
1342
1344
|
if (!targets.runMini) {
|
|
1343
|
-
|
|
1345
|
+
_chunkEL4WI75Zcjs.logger_default.warn("\u5F53\u524D\u547D\u4EE4\u4EC5\u652F\u6301\u5C0F\u7A0B\u5E8F\u5E73\u53F0\uFF0C\u8BF7\u901A\u8FC7 --platform weapp \u6307\u5B9A\u76EE\u6807\u3002");
|
|
1344
1346
|
return;
|
|
1345
1347
|
}
|
|
1346
1348
|
if (targets.runWeb) {
|
|
1347
|
-
|
|
1349
|
+
_chunkEL4WI75Zcjs.logger_default.warn("\u5206\u6790\u547D\u4EE4\u6682\u4E0D\u652F\u6301 Web \u5E73\u53F0\uFF0C\u5C06\u5FFD\u7565\u76F8\u5173\u914D\u7F6E\u3002");
|
|
1348
1350
|
}
|
|
1349
1351
|
const inlineConfig = createInlineConfig(targets.mpPlatform);
|
|
1350
1352
|
try {
|
|
1351
|
-
const ctx = await
|
|
1353
|
+
const ctx = await _chunkFB7KR7SHcjs.createCompilerContext.call(void 0, {
|
|
1352
1354
|
cwd: root,
|
|
1353
1355
|
mode: _nullishCoalesce(options.mode, () => ( "production")),
|
|
1354
1356
|
configFile,
|
|
@@ -1366,7 +1368,7 @@ function registerAnalyzeCommand(cli2) {
|
|
|
1366
1368
|
await _fsextra2.default.writeFile(resolvedOutputPath, `${JSON.stringify(result, null, 2)}
|
|
1367
1369
|
`, "utf8");
|
|
1368
1370
|
const relativeOutput = configService ? configService.relativeCwd(resolvedOutputPath) : resolvedOutputPath;
|
|
1369
|
-
|
|
1371
|
+
_chunkEL4WI75Zcjs.logger_default.success(`\u5206\u6790\u7ED3\u679C\u5DF2\u5199\u5165 ${relativeOutput}`);
|
|
1370
1372
|
writtenPath = resolvedOutputPath;
|
|
1371
1373
|
}
|
|
1372
1374
|
if (outputJson) {
|
|
@@ -1379,20 +1381,21 @@ function registerAnalyzeCommand(cli2) {
|
|
|
1379
1381
|
await startAnalyzeDashboard(result);
|
|
1380
1382
|
}
|
|
1381
1383
|
} catch (error) {
|
|
1382
|
-
|
|
1384
|
+
_chunkEL4WI75Zcjs.logger_default.error(error);
|
|
1383
1385
|
_process2.default.exitCode = 1;
|
|
1384
1386
|
}
|
|
1385
1387
|
});
|
|
1386
1388
|
}
|
|
1387
1389
|
|
|
1388
1390
|
// src/cli/commands/build.ts
|
|
1389
|
-
|
|
1391
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
1392
|
+
|
|
1390
1393
|
|
|
1391
1394
|
// src/cli/logBuildAppFinish.ts
|
|
1392
|
-
|
|
1395
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
1393
1396
|
|
|
1394
1397
|
// ../../node_modules/.pnpm/package-manager-detector@1.6.0/node_modules/package-manager-detector/dist/commands.mjs
|
|
1395
|
-
|
|
1398
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
1396
1399
|
function dashDashArg(agent, agentCommand) {
|
|
1397
1400
|
return (args) => {
|
|
1398
1401
|
if (args.length > 1) {
|
|
@@ -1537,15 +1540,15 @@ function logBuildAppFinish(configService, webServer, options = {}) {
|
|
|
1537
1540
|
const urls = webServer.resolvedUrls;
|
|
1538
1541
|
const candidates = urls ? [..._nullishCoalesce(urls.local, () => ( [])), ..._nullishCoalesce(urls.network, () => ( []))] : [];
|
|
1539
1542
|
if (candidates.length > 0) {
|
|
1540
|
-
|
|
1543
|
+
_chunkEL4WI75Zcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8\uFF0C\u6D4F\u89C8\u5668\u8BBF\u95EE\uFF1A");
|
|
1541
1544
|
for (const url of candidates) {
|
|
1542
|
-
|
|
1545
|
+
_chunkEL4WI75Zcjs.logger_default.info(` \u279C ${url}`);
|
|
1543
1546
|
}
|
|
1544
1547
|
} else {
|
|
1545
|
-
|
|
1548
|
+
_chunkEL4WI75Zcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
|
|
1546
1549
|
}
|
|
1547
1550
|
} else {
|
|
1548
|
-
|
|
1551
|
+
_chunkEL4WI75Zcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
|
|
1549
1552
|
}
|
|
1550
1553
|
logBuildAppFinishOnlyShowOnce = true;
|
|
1551
1554
|
return;
|
|
@@ -1559,32 +1562,32 @@ function logBuildAppFinish(configService, webServer, options = {}) {
|
|
|
1559
1562
|
args: ["run", "open"]
|
|
1560
1563
|
}));
|
|
1561
1564
|
const devCommand = `${command} ${args.join(" ")}`;
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
+
_chunkEL4WI75Zcjs.logger_default.success("\u5E94\u7528\u6784\u5EFA\u5B8C\u6210\uFF01\u9884\u89C8\u65B9\u5F0F ( `2` \u79CD\u9009\u5176\u4E00\u5373\u53EF)\uFF1A");
|
|
1566
|
+
_chunkEL4WI75Zcjs.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`);
|
|
1567
|
+
_chunkEL4WI75Zcjs.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");
|
|
1565
1568
|
if (!skipWeb && webServer) {
|
|
1566
1569
|
const urls = webServer.resolvedUrls;
|
|
1567
1570
|
const candidates = urls ? [..._nullishCoalesce(urls.local, () => ( [])), ..._nullishCoalesce(urls.network, () => ( []))] : [];
|
|
1568
1571
|
if (candidates.length > 0) {
|
|
1569
|
-
|
|
1572
|
+
_chunkEL4WI75Zcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8\uFF0C\u6D4F\u89C8\u5668\u8BBF\u95EE\uFF1A");
|
|
1570
1573
|
for (const url of candidates) {
|
|
1571
|
-
|
|
1574
|
+
_chunkEL4WI75Zcjs.logger_default.info(` \u279C ${url}`);
|
|
1572
1575
|
}
|
|
1573
1576
|
} else {
|
|
1574
|
-
|
|
1577
|
+
_chunkEL4WI75Zcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
|
|
1575
1578
|
}
|
|
1576
1579
|
}
|
|
1577
1580
|
logBuildAppFinishOnlyShowOnce = true;
|
|
1578
1581
|
}
|
|
1579
1582
|
|
|
1580
1583
|
// src/cli/openIde.ts
|
|
1581
|
-
|
|
1584
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
1582
1585
|
var _weappidecli = require('weapp-ide-cli');
|
|
1583
1586
|
async function openIde() {
|
|
1584
1587
|
try {
|
|
1585
1588
|
await _weappidecli.parse.call(void 0, ["open", "-p"]);
|
|
1586
1589
|
} catch (error) {
|
|
1587
|
-
|
|
1590
|
+
_chunkEL4WI75Zcjs.logger_default.error(error);
|
|
1588
1591
|
}
|
|
1589
1592
|
}
|
|
1590
1593
|
|
|
@@ -1605,7 +1608,7 @@ function registerBuildCommand(cli2) {
|
|
|
1605
1608
|
const targets = resolveRuntimeTargets(options);
|
|
1606
1609
|
logRuntimeTarget(targets);
|
|
1607
1610
|
const inlineConfig = createInlineConfig(targets.mpPlatform);
|
|
1608
|
-
const ctx = await
|
|
1611
|
+
const ctx = await _chunkFB7KR7SHcjs.createCompilerContext.call(void 0, {
|
|
1609
1612
|
cwd: root,
|
|
1610
1613
|
mode: _nullishCoalesce(options.mode, () => ( "production")),
|
|
1611
1614
|
configFile,
|
|
@@ -1625,9 +1628,9 @@ function registerBuildCommand(cli2) {
|
|
|
1625
1628
|
if (targets.runWeb && _optionalChain([webConfig, 'optionalAccess', _14 => _14.enabled])) {
|
|
1626
1629
|
try {
|
|
1627
1630
|
await _optionalChain([webService, 'optionalAccess', _15 => _15.build, 'call', _16 => _16()]);
|
|
1628
|
-
|
|
1631
|
+
_chunkEL4WI75Zcjs.logger_default.success(`Web \u6784\u5EFA\u5B8C\u6210\uFF0C\u8F93\u51FA\u76EE\u5F55\uFF1A${configService.relativeCwd(webConfig.outDir)}`);
|
|
1629
1632
|
} catch (error) {
|
|
1630
|
-
|
|
1633
|
+
_chunkEL4WI75Zcjs.logger_default.error(error);
|
|
1631
1634
|
throw error;
|
|
1632
1635
|
}
|
|
1633
1636
|
}
|
|
@@ -1640,11 +1643,33 @@ function registerBuildCommand(cli2) {
|
|
|
1640
1643
|
if (analyzeHandle) {
|
|
1641
1644
|
await analyzeHandle.waitForExit();
|
|
1642
1645
|
}
|
|
1646
|
+
_optionalChain([ctx, 'access', _17 => _17.watcherService, 'optionalAccess', _18 => _18.closeAll, 'call', _19 => _19()]);
|
|
1647
|
+
terminateStaleSassEmbeddedProcess();
|
|
1643
1648
|
});
|
|
1644
1649
|
}
|
|
1650
|
+
function terminateStaleSassEmbeddedProcess() {
|
|
1651
|
+
const getHandles = _process2.default._getActiveHandles;
|
|
1652
|
+
const handles = typeof getHandles === "function" ? getHandles() : void 0;
|
|
1653
|
+
if (!Array.isArray(handles)) {
|
|
1654
|
+
return;
|
|
1655
|
+
}
|
|
1656
|
+
for (const handle of handles) {
|
|
1657
|
+
if (isSassEmbeddedChild(handle)) {
|
|
1658
|
+
try {
|
|
1659
|
+
handle.kill();
|
|
1660
|
+
} catch (e) {
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
function isSassEmbeddedChild(handle) {
|
|
1666
|
+
return Boolean(
|
|
1667
|
+
handle && typeof handle === "object" && "kill" in handle && "spawnfile" in handle && typeof handle.spawnfile === "string" && _optionalChain([handle, 'access', _20 => _20.spawnfile, 'optionalAccess', _21 => _21.includes, 'call', _22 => _22("sass-embedded")])
|
|
1668
|
+
);
|
|
1669
|
+
}
|
|
1645
1670
|
|
|
1646
1671
|
// src/cli/commands/create.ts
|
|
1647
|
-
|
|
1672
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
1648
1673
|
var _init = require('@weapp-core/init');
|
|
1649
1674
|
function registerCreateCommand(cli2) {
|
|
1650
1675
|
cli2.command("create [outDir]", "create project").option("-t, --template <type>", "template type").action(async (outDir, options) => {
|
|
@@ -1653,11 +1678,11 @@ function registerCreateCommand(cli2) {
|
|
|
1653
1678
|
}
|
|
1654
1679
|
|
|
1655
1680
|
// src/cli/commands/generate.ts
|
|
1656
|
-
|
|
1681
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
1657
1682
|
|
|
1658
1683
|
|
|
1659
1684
|
// src/schematics.ts
|
|
1660
|
-
|
|
1685
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
1661
1686
|
|
|
1662
1687
|
var _schematics = require('@weapp-core/schematics');
|
|
1663
1688
|
var _shared = require('@weapp-core/shared');
|
|
@@ -1699,11 +1724,11 @@ async function loadTemplate(template, context) {
|
|
|
1699
1724
|
return void 0;
|
|
1700
1725
|
}
|
|
1701
1726
|
function resolveTemplate(templates, type, fileType) {
|
|
1702
|
-
const scoped = _optionalChain([templates, 'optionalAccess',
|
|
1727
|
+
const scoped = _optionalChain([templates, 'optionalAccess', _23 => _23[type], 'optionalAccess', _24 => _24[fileType]]);
|
|
1703
1728
|
if (scoped !== void 0) {
|
|
1704
1729
|
return scoped;
|
|
1705
1730
|
}
|
|
1706
|
-
return _optionalChain([templates, 'optionalAccess',
|
|
1731
|
+
return _optionalChain([templates, 'optionalAccess', _25 => _25.shared, 'optionalAccess', _26 => _26[fileType]]);
|
|
1707
1732
|
}
|
|
1708
1733
|
async function generate(options) {
|
|
1709
1734
|
let { fileName, outDir, extensions, type, cwd, templates } = _shared.defu.call(void 0, options, {
|
|
@@ -1758,13 +1783,13 @@ async function generate(options) {
|
|
|
1758
1783
|
for (const { code, fileName: fileName2 } of files) {
|
|
1759
1784
|
if (code !== void 0) {
|
|
1760
1785
|
await _fsextra2.default.outputFile(_pathe2.default.resolve(basepath, fileName2), code, "utf8");
|
|
1761
|
-
|
|
1786
|
+
_chunkEL4WI75Zcjs.logger_default.success(`${composePath(outDir, fileName2)} \u521B\u5EFA\u6210\u529F\uFF01`);
|
|
1762
1787
|
}
|
|
1763
1788
|
}
|
|
1764
1789
|
}
|
|
1765
1790
|
|
|
1766
1791
|
// src/cli/loadConfig.ts
|
|
1767
|
-
|
|
1792
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
1768
1793
|
|
|
1769
1794
|
|
|
1770
1795
|
|
|
@@ -1780,14 +1805,14 @@ async function loadConfig(configFile) {
|
|
|
1780
1805
|
mode: "development"
|
|
1781
1806
|
};
|
|
1782
1807
|
const loaded = await _vite.loadConfigFromFile.call(void 0, configEnv, resolvedConfigFile, cwd);
|
|
1783
|
-
const weappConfigFilePath = await
|
|
1808
|
+
const weappConfigFilePath = await _chunkEL4WI75Zcjs.resolveWeappConfigFile.call(void 0, {
|
|
1784
1809
|
root: cwd,
|
|
1785
1810
|
specified: resolvedConfigFile
|
|
1786
1811
|
});
|
|
1787
1812
|
let weappLoaded;
|
|
1788
1813
|
if (weappConfigFilePath) {
|
|
1789
1814
|
const normalizedWeappPath = _pathe2.default.resolve(weappConfigFilePath);
|
|
1790
|
-
const normalizedLoadedPath = _optionalChain([loaded, 'optionalAccess',
|
|
1815
|
+
const normalizedLoadedPath = _optionalChain([loaded, 'optionalAccess', _27 => _27.path]) ? _pathe2.default.resolve(loaded.path) : void 0;
|
|
1791
1816
|
if (normalizedLoadedPath && normalizedLoadedPath === normalizedWeappPath) {
|
|
1792
1817
|
weappLoaded = loaded;
|
|
1793
1818
|
} else {
|
|
@@ -1797,23 +1822,23 @@ async function loadConfig(configFile) {
|
|
|
1797
1822
|
if (!loaded && !weappLoaded) {
|
|
1798
1823
|
return void 0;
|
|
1799
1824
|
}
|
|
1800
|
-
const config = _nullishCoalesce(_optionalChain([loaded, 'optionalAccess',
|
|
1801
|
-
if (_optionalChain([weappLoaded, 'optionalAccess',
|
|
1825
|
+
const config = _nullishCoalesce(_optionalChain([loaded, 'optionalAccess', _28 => _28.config]), () => ( (_nullishCoalesce(_optionalChain([weappLoaded, 'optionalAccess', _29 => _29.config]), () => ( {})))));
|
|
1826
|
+
if (_optionalChain([weappLoaded, 'optionalAccess', _30 => _30.config, 'optionalAccess', _31 => _31.weapp])) {
|
|
1802
1827
|
config.weapp = _shared.defu.call(void 0,
|
|
1803
1828
|
weappLoaded.config.weapp,
|
|
1804
1829
|
_nullishCoalesce(config.weapp, () => ( {}))
|
|
1805
1830
|
);
|
|
1806
1831
|
}
|
|
1807
1832
|
const dependencySet = /* @__PURE__ */ new Set();
|
|
1808
|
-
for (const dependency of _nullishCoalesce(_optionalChain([loaded, 'optionalAccess',
|
|
1833
|
+
for (const dependency of _nullishCoalesce(_optionalChain([loaded, 'optionalAccess', _32 => _32.dependencies]), () => ( []))) {
|
|
1809
1834
|
dependencySet.add(dependency);
|
|
1810
1835
|
}
|
|
1811
|
-
for (const dependency of _nullishCoalesce(_optionalChain([weappLoaded, 'optionalAccess',
|
|
1836
|
+
for (const dependency of _nullishCoalesce(_optionalChain([weappLoaded, 'optionalAccess', _33 => _33.dependencies]), () => ( []))) {
|
|
1812
1837
|
dependencySet.add(dependency);
|
|
1813
1838
|
}
|
|
1814
1839
|
return {
|
|
1815
1840
|
config,
|
|
1816
|
-
path: _nullishCoalesce(_nullishCoalesce(_optionalChain([weappLoaded, 'optionalAccess',
|
|
1841
|
+
path: _nullishCoalesce(_nullishCoalesce(_optionalChain([weappLoaded, 'optionalAccess', _34 => _34.path]), () => ( _optionalChain([loaded, 'optionalAccess', _35 => _35.path]))), () => ( resolvedConfigFile)),
|
|
1817
1842
|
dependencies: Array.from(dependencySet)
|
|
1818
1843
|
};
|
|
1819
1844
|
}
|
|
@@ -1833,26 +1858,26 @@ function registerGenerateCommand(cli2) {
|
|
|
1833
1858
|
fileName = "app";
|
|
1834
1859
|
}
|
|
1835
1860
|
if (filepath === void 0) {
|
|
1836
|
-
|
|
1861
|
+
_chunkEL4WI75Zcjs.logger_default.error("weapp-vite generate <outDir> \u547D\u4EE4\u5FC5\u987B\u4F20\u5165\u8DEF\u5F84\u53C2\u6570 outDir");
|
|
1837
1862
|
return;
|
|
1838
1863
|
}
|
|
1839
1864
|
if (options.page) {
|
|
1840
1865
|
type = "page";
|
|
1841
1866
|
}
|
|
1842
|
-
const generateOptions = _optionalChain([config, 'optionalAccess',
|
|
1843
|
-
fileName = _nullishCoalesce(_optionalChain([generateOptions, 'optionalAccess',
|
|
1867
|
+
const generateOptions = _optionalChain([config, 'optionalAccess', _36 => _36.config, 'access', _37 => _37.weapp, 'optionalAccess', _38 => _38.generate]);
|
|
1868
|
+
fileName = _nullishCoalesce(_optionalChain([generateOptions, 'optionalAccess', _39 => _39.filenames, 'optionalAccess', _40 => _40[type]]), () => ( fileName));
|
|
1844
1869
|
await generate({
|
|
1845
|
-
outDir: _pathe2.default.join(_nullishCoalesce(_optionalChain([generateOptions, 'optionalAccess',
|
|
1870
|
+
outDir: _pathe2.default.join(_nullishCoalesce(_optionalChain([generateOptions, 'optionalAccess', _41 => _41.dirs, 'optionalAccess', _42 => _42[type]]), () => ( "")), filepath),
|
|
1846
1871
|
type,
|
|
1847
1872
|
fileName,
|
|
1848
|
-
extensions: _optionalChain([generateOptions, 'optionalAccess',
|
|
1849
|
-
templates: _optionalChain([generateOptions, 'optionalAccess',
|
|
1873
|
+
extensions: _optionalChain([generateOptions, 'optionalAccess', _43 => _43.extensions]),
|
|
1874
|
+
templates: _optionalChain([generateOptions, 'optionalAccess', _44 => _44.templates])
|
|
1850
1875
|
});
|
|
1851
1876
|
});
|
|
1852
1877
|
}
|
|
1853
1878
|
|
|
1854
1879
|
// src/cli/commands/init.ts
|
|
1855
|
-
|
|
1880
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
1856
1881
|
|
|
1857
1882
|
function registerInitCommand(cli2) {
|
|
1858
1883
|
cli2.command("init").action(async () => {
|
|
@@ -1861,26 +1886,26 @@ function registerInitCommand(cli2) {
|
|
|
1861
1886
|
command: "weapp-vite"
|
|
1862
1887
|
});
|
|
1863
1888
|
} catch (error) {
|
|
1864
|
-
|
|
1889
|
+
_chunkEL4WI75Zcjs.logger_default.error(error);
|
|
1865
1890
|
}
|
|
1866
1891
|
});
|
|
1867
1892
|
}
|
|
1868
1893
|
|
|
1869
1894
|
// src/cli/commands/npm.ts
|
|
1870
|
-
|
|
1895
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
1871
1896
|
|
|
1872
1897
|
function registerNpmCommand(cli2) {
|
|
1873
1898
|
cli2.command("npm").alias("build:npm").alias("build-npm").action(async () => {
|
|
1874
1899
|
try {
|
|
1875
1900
|
await _weappidecli.parse.call(void 0, ["build-npm", "-p"]);
|
|
1876
1901
|
} catch (error) {
|
|
1877
|
-
|
|
1902
|
+
_chunkEL4WI75Zcjs.logger_default.error(error);
|
|
1878
1903
|
}
|
|
1879
1904
|
});
|
|
1880
1905
|
}
|
|
1881
1906
|
|
|
1882
1907
|
// src/cli/commands/open.ts
|
|
1883
|
-
|
|
1908
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
1884
1909
|
function registerOpenCommand(cli2) {
|
|
1885
1910
|
cli2.command("open").action(async () => {
|
|
1886
1911
|
await openIde();
|
|
@@ -1888,7 +1913,7 @@ function registerOpenCommand(cli2) {
|
|
|
1888
1913
|
}
|
|
1889
1914
|
|
|
1890
1915
|
// src/cli/commands/serve.ts
|
|
1891
|
-
|
|
1916
|
+
_chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
1892
1917
|
function registerServeCommand(cli2) {
|
|
1893
1918
|
cli2.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)`).option("--analyze", `[boolean] \u542F\u52A8\u5206\u5305\u5206\u6790\u4EEA\u8868\u76D8 (\u5B9E\u9A8C\u7279\u6027)`, { default: false }).action(async (root, options) => {
|
|
1894
1919
|
filterDuplicateOptions(options);
|
|
@@ -1896,7 +1921,7 @@ function registerServeCommand(cli2) {
|
|
|
1896
1921
|
const targets = resolveRuntimeTargets(options);
|
|
1897
1922
|
logRuntimeTarget(targets);
|
|
1898
1923
|
const inlineConfig = createInlineConfig(targets.mpPlatform);
|
|
1899
|
-
const ctx = await
|
|
1924
|
+
const ctx = await _chunkFB7KR7SHcjs.createCompilerContext.call(void 0, {
|
|
1900
1925
|
cwd: root,
|
|
1901
1926
|
mode: _nullishCoalesce(options.mode, () => ( "development")),
|
|
1902
1927
|
isDev: true,
|
|
@@ -1938,9 +1963,9 @@ function registerServeCommand(cli2) {
|
|
|
1938
1963
|
let webServer;
|
|
1939
1964
|
if (targets.runWeb) {
|
|
1940
1965
|
try {
|
|
1941
|
-
webServer = await _optionalChain([webService, 'optionalAccess',
|
|
1966
|
+
webServer = await _optionalChain([webService, 'optionalAccess', _45 => _45.startDevServer, 'call', _46 => _46()]);
|
|
1942
1967
|
} catch (error) {
|
|
1943
|
-
|
|
1968
|
+
_chunkEL4WI75Zcjs.logger_default.error(error);
|
|
1944
1969
|
throw error;
|
|
1945
1970
|
}
|
|
1946
1971
|
}
|
|
@@ -1961,12 +1986,12 @@ function registerServeCommand(cli2) {
|
|
|
1961
1986
|
// src/cli.ts
|
|
1962
1987
|
var cli = cac("weapp-vite");
|
|
1963
1988
|
try {
|
|
1964
|
-
|
|
1989
|
+
_chunkEL4WI75Zcjs.checkRuntime.call(void 0, {
|
|
1965
1990
|
bun: "0.0.0",
|
|
1966
1991
|
deno: "0.0.0",
|
|
1967
1992
|
node: "20.19.0"
|
|
1968
1993
|
});
|
|
1969
|
-
} catch (
|
|
1994
|
+
} catch (e2) {
|
|
1970
1995
|
}
|
|
1971
1996
|
cli.option("-c, --config <file>", `[string] use specified config file`).option("--base <path>", `[string] public base path (default: /)`, {
|
|
1972
1997
|
type: [convertBase]
|
|
@@ -1980,5 +2005,5 @@ registerNpmCommand(cli);
|
|
|
1980
2005
|
registerGenerateCommand(cli);
|
|
1981
2006
|
registerCreateCommand(cli);
|
|
1982
2007
|
cli.help();
|
|
1983
|
-
cli.version(
|
|
2008
|
+
cli.version(_chunkIEICAJDZcjs.VERSION);
|
|
1984
2009
|
cli.parse();
|