weapp-vite 5.7.2 → 5.9.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/dist/auto-routes.cjs +2 -2
- package/dist/auto-routes.mjs +1 -1
- package/dist/{chunk-3WGK7INY.mjs → chunk-7HMGYHVJ.mjs} +1 -1
- package/dist/{chunk-AUQJOLJS.cjs → chunk-7NTZAAMD.cjs} +4 -4
- package/dist/{chunk-HKSOVHNE.cjs → chunk-CFTSVRD4.cjs} +421 -239
- package/dist/{chunk-FSDX3XLK.mjs → chunk-JCCRRTKA.mjs} +190 -8
- package/dist/cli.cjs +55 -55
- package/dist/cli.mjs +2 -2
- package/dist/{config-C-oMiscN.d.cts → config-C8y2cWbg.d.cts} +23 -21
- package/dist/{config-CbKHc1kT.d.ts → config-CRwMOjkF.d.ts} +23 -21
- package/dist/config.d.cts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/json.d.cts +1 -1
- package/dist/json.d.ts +1 -1
- package/dist/types.d.cts +2 -2
- package/dist/types.d.ts +2 -2
- package/modules/analyze-dashboard/assets/vue.js +8 -2
- package/package.json +8 -8
|
@@ -2677,9 +2677,152 @@ function resolveBaseDir(configService) {
|
|
|
2677
2677
|
}
|
|
2678
2678
|
return configService.cwd;
|
|
2679
2679
|
}
|
|
2680
|
+
function cloneAutoImportComponents(config) {
|
|
2681
|
+
if (!config || config === false) {
|
|
2682
|
+
return void 0;
|
|
2683
|
+
}
|
|
2684
|
+
const cloned = {};
|
|
2685
|
+
if (config.globs?.length) {
|
|
2686
|
+
cloned.globs = [...config.globs];
|
|
2687
|
+
}
|
|
2688
|
+
if (config.resolvers?.length) {
|
|
2689
|
+
cloned.resolvers = [...config.resolvers];
|
|
2690
|
+
}
|
|
2691
|
+
if (config.output !== void 0) {
|
|
2692
|
+
cloned.output = config.output;
|
|
2693
|
+
}
|
|
2694
|
+
if (config.typedComponents !== void 0) {
|
|
2695
|
+
cloned.typedComponents = config.typedComponents;
|
|
2696
|
+
}
|
|
2697
|
+
if (config.htmlCustomData !== void 0) {
|
|
2698
|
+
cloned.htmlCustomData = config.htmlCustomData;
|
|
2699
|
+
}
|
|
2700
|
+
return cloned;
|
|
2701
|
+
}
|
|
2702
|
+
function mergeGlobs(base, extra) {
|
|
2703
|
+
const values = [
|
|
2704
|
+
...base ?? [],
|
|
2705
|
+
...extra ?? []
|
|
2706
|
+
].map((entry) => entry?.trim()).filter((entry) => Boolean(entry));
|
|
2707
|
+
if (!values.length) {
|
|
2708
|
+
return void 0;
|
|
2709
|
+
}
|
|
2710
|
+
const deduped = [];
|
|
2711
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2712
|
+
for (const entry of values) {
|
|
2713
|
+
if (seen.has(entry)) {
|
|
2714
|
+
continue;
|
|
2715
|
+
}
|
|
2716
|
+
seen.add(entry);
|
|
2717
|
+
deduped.push(entry);
|
|
2718
|
+
}
|
|
2719
|
+
return deduped;
|
|
2720
|
+
}
|
|
2721
|
+
function mergeResolvers(base, extra) {
|
|
2722
|
+
const merged = [
|
|
2723
|
+
...base ?? [],
|
|
2724
|
+
...extra ?? []
|
|
2725
|
+
].filter(Boolean);
|
|
2726
|
+
return merged.length ? merged : void 0;
|
|
2727
|
+
}
|
|
2728
|
+
function mergeAutoImportComponents(lower, upper, preferUpperScalars = false) {
|
|
2729
|
+
if (!lower && !upper) {
|
|
2730
|
+
return void 0;
|
|
2731
|
+
}
|
|
2732
|
+
if (!lower) {
|
|
2733
|
+
return cloneAutoImportComponents(upper);
|
|
2734
|
+
}
|
|
2735
|
+
if (!upper) {
|
|
2736
|
+
return cloneAutoImportComponents(lower);
|
|
2737
|
+
}
|
|
2738
|
+
const merged = {};
|
|
2739
|
+
const globs = mergeGlobs(lower.globs, upper.globs);
|
|
2740
|
+
if (globs) {
|
|
2741
|
+
merged.globs = globs;
|
|
2742
|
+
}
|
|
2743
|
+
const resolvers = mergeResolvers(lower.resolvers, upper.resolvers);
|
|
2744
|
+
if (resolvers) {
|
|
2745
|
+
merged.resolvers = resolvers;
|
|
2746
|
+
}
|
|
2747
|
+
const pickScalar = (baseline, candidate) => {
|
|
2748
|
+
return preferUpperScalars ? candidate ?? baseline : baseline ?? candidate;
|
|
2749
|
+
};
|
|
2750
|
+
const output = pickScalar(lower.output, upper.output);
|
|
2751
|
+
if (output !== void 0) {
|
|
2752
|
+
merged.output = output;
|
|
2753
|
+
}
|
|
2754
|
+
const typedComponents = pickScalar(lower.typedComponents, upper.typedComponents);
|
|
2755
|
+
if (typedComponents !== void 0) {
|
|
2756
|
+
merged.typedComponents = typedComponents;
|
|
2757
|
+
}
|
|
2758
|
+
const htmlCustomData = pickScalar(lower.htmlCustomData, upper.htmlCustomData);
|
|
2759
|
+
if (htmlCustomData !== void 0) {
|
|
2760
|
+
merged.htmlCustomData = htmlCustomData;
|
|
2761
|
+
}
|
|
2762
|
+
return merged;
|
|
2763
|
+
}
|
|
2764
|
+
function normalizeGlobRoot(root) {
|
|
2765
|
+
return root.replace(/\\/g, "/").replace(/^\/+|\/+$/g, "");
|
|
2766
|
+
}
|
|
2767
|
+
function createDefaultAutoImportComponents(configService) {
|
|
2768
|
+
const globs = /* @__PURE__ */ new Set();
|
|
2769
|
+
globs.add("components/**/*.wxml");
|
|
2770
|
+
const subPackages = configService.weappViteConfig?.subPackages;
|
|
2771
|
+
if (subPackages) {
|
|
2772
|
+
for (const [root, subConfig] of Object.entries(subPackages)) {
|
|
2773
|
+
if (!root) {
|
|
2774
|
+
continue;
|
|
2775
|
+
}
|
|
2776
|
+
if (subConfig?.autoImportComponents === false) {
|
|
2777
|
+
continue;
|
|
2778
|
+
}
|
|
2779
|
+
const normalized = normalizeGlobRoot(root);
|
|
2780
|
+
if (!normalized) {
|
|
2781
|
+
continue;
|
|
2782
|
+
}
|
|
2783
|
+
globs.add(`${normalized}/components/**/*.wxml`);
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
return globs.size ? { globs: Array.from(globs) } : void 0;
|
|
2787
|
+
}
|
|
2680
2788
|
function getAutoImportConfig(configService) {
|
|
2681
|
-
|
|
2682
|
-
|
|
2789
|
+
if (!configService) {
|
|
2790
|
+
return void 0;
|
|
2791
|
+
}
|
|
2792
|
+
const weappConfig = configService.weappViteConfig;
|
|
2793
|
+
if (!weappConfig) {
|
|
2794
|
+
return void 0;
|
|
2795
|
+
}
|
|
2796
|
+
const userConfigured = weappConfig.autoImportComponents ?? weappConfig.enhance?.autoImportComponents;
|
|
2797
|
+
if (userConfigured === false) {
|
|
2798
|
+
return void 0;
|
|
2799
|
+
}
|
|
2800
|
+
const fallbackConfig = userConfigured === void 0 ? createDefaultAutoImportComponents(configService) : void 0;
|
|
2801
|
+
const baseConfig = cloneAutoImportComponents(userConfigured ?? fallbackConfig);
|
|
2802
|
+
const subPackageConfigs = weappConfig.subPackages;
|
|
2803
|
+
const currentRoot = configService.currentSubPackageRoot;
|
|
2804
|
+
if (currentRoot) {
|
|
2805
|
+
const scopedRaw = subPackageConfigs?.[currentRoot]?.autoImportComponents;
|
|
2806
|
+
if (scopedRaw === false) {
|
|
2807
|
+
return void 0;
|
|
2808
|
+
}
|
|
2809
|
+
const scoped = cloneAutoImportComponents(scopedRaw);
|
|
2810
|
+
return mergeAutoImportComponents(baseConfig, scoped, true) ?? baseConfig ?? scoped;
|
|
2811
|
+
}
|
|
2812
|
+
let merged = baseConfig;
|
|
2813
|
+
if (subPackageConfigs) {
|
|
2814
|
+
for (const root of Object.keys(subPackageConfigs)) {
|
|
2815
|
+
const scopedRaw = subPackageConfigs[root]?.autoImportComponents;
|
|
2816
|
+
if (!scopedRaw || scopedRaw === false) {
|
|
2817
|
+
continue;
|
|
2818
|
+
}
|
|
2819
|
+
const scoped = cloneAutoImportComponents(scopedRaw);
|
|
2820
|
+
if (scoped && scoped !== false) {
|
|
2821
|
+
merged = mergeAutoImportComponents(merged, scoped, false);
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
return merged;
|
|
2683
2826
|
}
|
|
2684
2827
|
function resolveManifestOutputPath(configService, manifestFileName = DEFAULT_AUTO_IMPORT_MANIFEST_FILENAME) {
|
|
2685
2828
|
if (!configService) {
|
|
@@ -21465,8 +21608,8 @@ function createAutoImportPlugin(state) {
|
|
|
21465
21608
|
if (!state.resolvedConfig) {
|
|
21466
21609
|
return;
|
|
21467
21610
|
}
|
|
21468
|
-
const
|
|
21469
|
-
const globs =
|
|
21611
|
+
const autoImportConfig = getAutoImportConfig(configService);
|
|
21612
|
+
const globs = autoImportConfig?.globs;
|
|
21470
21613
|
const globsKey = globs?.join("\0") ?? "";
|
|
21471
21614
|
if (globsKey !== state.lastGlobsKey) {
|
|
21472
21615
|
state.initialScanDone = false;
|
|
@@ -25213,6 +25356,46 @@ function createMergeFactories(options) {
|
|
|
25213
25356
|
injectBuiltinAliases(inlineConfig);
|
|
25214
25357
|
return inlineConfig;
|
|
25215
25358
|
}
|
|
25359
|
+
function normalizePluginOptions(option) {
|
|
25360
|
+
const normalized = [];
|
|
25361
|
+
if (!option) {
|
|
25362
|
+
return normalized;
|
|
25363
|
+
}
|
|
25364
|
+
if (Array.isArray(option)) {
|
|
25365
|
+
for (const entry of option) {
|
|
25366
|
+
normalized.push(...normalizePluginOptions(entry));
|
|
25367
|
+
}
|
|
25368
|
+
return normalized;
|
|
25369
|
+
}
|
|
25370
|
+
normalized.push(option);
|
|
25371
|
+
return normalized;
|
|
25372
|
+
}
|
|
25373
|
+
function isNamedPlugin(option, name) {
|
|
25374
|
+
return typeof option === "object" && option !== null && "name" in option && option.name === name;
|
|
25375
|
+
}
|
|
25376
|
+
function arrangePlugins(config, subPackageMeta) {
|
|
25377
|
+
const existing = normalizePluginOptions(config.plugins);
|
|
25378
|
+
const tsconfigPlugins = [];
|
|
25379
|
+
const others = [];
|
|
25380
|
+
for (const entry of existing) {
|
|
25381
|
+
if (!entry) {
|
|
25382
|
+
continue;
|
|
25383
|
+
}
|
|
25384
|
+
if (isNamedPlugin(entry, "vite-tsconfig-paths")) {
|
|
25385
|
+
tsconfigPlugins.push(entry);
|
|
25386
|
+
continue;
|
|
25387
|
+
}
|
|
25388
|
+
if (isNamedPlugin(entry, WEAPP_VITE_CONTEXT_PLUGIN_NAME)) {
|
|
25389
|
+
continue;
|
|
25390
|
+
}
|
|
25391
|
+
others.push(entry);
|
|
25392
|
+
}
|
|
25393
|
+
config.plugins = [
|
|
25394
|
+
vitePluginWeapp(ctx, subPackageMeta),
|
|
25395
|
+
...others,
|
|
25396
|
+
...tsconfigPlugins
|
|
25397
|
+
];
|
|
25398
|
+
}
|
|
25216
25399
|
function merge(subPackageMeta, ...configs) {
|
|
25217
25400
|
ensureConfigService();
|
|
25218
25401
|
const currentOptions = getOptions2();
|
|
@@ -25249,7 +25432,6 @@ function createMergeFactories(options) {
|
|
|
25249
25432
|
{
|
|
25250
25433
|
root: currentOptions.cwd,
|
|
25251
25434
|
mode: "development",
|
|
25252
|
-
plugins: [vitePluginWeapp(ctx, subPackageMeta)],
|
|
25253
25435
|
define: getDefineImportMetaEnv(),
|
|
25254
25436
|
build: {
|
|
25255
25437
|
watch: {
|
|
@@ -25269,6 +25451,7 @@ function createMergeFactories(options) {
|
|
|
25269
25451
|
}
|
|
25270
25452
|
}
|
|
25271
25453
|
);
|
|
25454
|
+
arrangePlugins(inline, subPackageMeta);
|
|
25272
25455
|
injectBuiltinAliases(inline);
|
|
25273
25456
|
return inline;
|
|
25274
25457
|
}
|
|
@@ -25277,9 +25460,6 @@ function createMergeFactories(options) {
|
|
|
25277
25460
|
...configs,
|
|
25278
25461
|
{
|
|
25279
25462
|
root: currentOptions.cwd,
|
|
25280
|
-
plugins: [
|
|
25281
|
-
vitePluginWeapp(ctx, subPackageMeta)
|
|
25282
|
-
],
|
|
25283
25463
|
mode: "production",
|
|
25284
25464
|
define: getDefineImportMetaEnv(),
|
|
25285
25465
|
build: {
|
|
@@ -25291,6 +25471,7 @@ function createMergeFactories(options) {
|
|
|
25291
25471
|
}
|
|
25292
25472
|
}
|
|
25293
25473
|
);
|
|
25474
|
+
arrangePlugins(inlineConfig, subPackageMeta);
|
|
25294
25475
|
inlineConfig.logLevel = "info";
|
|
25295
25476
|
injectBuiltinAliases(inlineConfig);
|
|
25296
25477
|
const currentRoot = subPackageMeta?.subPackage.root;
|
|
@@ -27295,6 +27476,7 @@ function createScanService(ctx) {
|
|
|
27295
27476
|
const subPackageConfig = ctx.configService.weappViteConfig?.subPackages?.[subPackage.root];
|
|
27296
27477
|
meta.subPackage.dependencies = subPackageConfig?.dependencies;
|
|
27297
27478
|
meta.subPackage.inlineConfig = subPackageConfig?.inlineConfig;
|
|
27479
|
+
meta.autoImportComponents = subPackageConfig?.autoImportComponents;
|
|
27298
27480
|
meta.styleEntries = normalizeSubPackageStyleEntries(
|
|
27299
27481
|
subPackageConfig?.styles,
|
|
27300
27482
|
subPackage,
|
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 _chunk7NTZAAMDcjs = require('./chunk-7NTZAAMD.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ var _chunkAUQJOLJScjs = require('./chunk-AUQJOLJS.cjs');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkCFTSVRD4cjs = require('./chunk-CFTSVRD4.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -618,7 +618,7 @@ var _buffer = require('buffer');
|
|
|
618
618
|
|
|
619
619
|
var _vite = require('vite');
|
|
620
620
|
var VIRTUAL_MODULE_INDICATOR = "\0";
|
|
621
|
-
var VIRTUAL_PREFIX = `${
|
|
621
|
+
var VIRTUAL_PREFIX = `${_chunkCFTSVRD4cjs.SHARED_CHUNK_VIRTUAL_PREFIX}/`;
|
|
622
622
|
function isPathInside(parent, candidate) {
|
|
623
623
|
if (!parent) {
|
|
624
624
|
return false;
|
|
@@ -981,7 +981,7 @@ async function analyzeSubpackages(ctx) {
|
|
|
981
981
|
};
|
|
982
982
|
const analysisConfig = configService.merge(
|
|
983
983
|
void 0,
|
|
984
|
-
|
|
984
|
+
_chunkCFTSVRD4cjs.createSharedBuildConfig.call(void 0, configService, scanService),
|
|
985
985
|
{
|
|
986
986
|
build: {
|
|
987
987
|
write: false,
|
|
@@ -1079,7 +1079,7 @@ async function waitForServerExit(server) {
|
|
|
1079
1079
|
try {
|
|
1080
1080
|
await server.close();
|
|
1081
1081
|
} catch (error) {
|
|
1082
|
-
|
|
1082
|
+
_chunkCFTSVRD4cjs.logger_default.error(error);
|
|
1083
1083
|
}
|
|
1084
1084
|
};
|
|
1085
1085
|
const signals = ["SIGINT", "SIGTERM"];
|
|
@@ -1157,16 +1157,16 @@ async function startAnalyzeDashboard(result, options) {
|
|
|
1157
1157
|
urls
|
|
1158
1158
|
};
|
|
1159
1159
|
if (_optionalChain([options, 'optionalAccess', _9 => _9.watch])) {
|
|
1160
|
-
|
|
1160
|
+
_chunkCFTSVRD4cjs.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
1161
|
for (const url of handle.urls) {
|
|
1162
|
-
|
|
1162
|
+
_chunkCFTSVRD4cjs.logger_default.info(`\u5206\u5305\u5206\u6790\u4EEA\u8868\u76D8\uFF1A${url}`);
|
|
1163
1163
|
}
|
|
1164
1164
|
void waitPromise;
|
|
1165
1165
|
return handle;
|
|
1166
1166
|
}
|
|
1167
|
-
|
|
1167
|
+
_chunkCFTSVRD4cjs.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
1168
|
for (const url of handle.urls) {
|
|
1169
|
-
|
|
1169
|
+
_chunkCFTSVRD4cjs.logger_default.info(`\u5206\u5305\u5206\u6790\u4EEA\u8868\u76D8\uFF1A${url}`);
|
|
1170
1170
|
}
|
|
1171
1171
|
await waitPromise;
|
|
1172
1172
|
}
|
|
@@ -1223,7 +1223,7 @@ function coerceBooleanOption(value) {
|
|
|
1223
1223
|
// src/cli/runtime.ts
|
|
1224
1224
|
_chunkQKFYCWOCcjs.init_cjs_shims.call(void 0, );
|
|
1225
1225
|
function logRuntimeTarget(targets) {
|
|
1226
|
-
|
|
1226
|
+
_chunkCFTSVRD4cjs.logger_default.info(`\u76EE\u6807\u5E73\u53F0\uFF1A${targets.label}`);
|
|
1227
1227
|
}
|
|
1228
1228
|
function resolveRuntimeTargets(options) {
|
|
1229
1229
|
const rawPlatform = typeof options.platform === "string" ? options.platform : typeof options.p === "string" ? options.p : void 0;
|
|
@@ -1231,17 +1231,17 @@ function resolveRuntimeTargets(options) {
|
|
|
1231
1231
|
return {
|
|
1232
1232
|
runMini: true,
|
|
1233
1233
|
runWeb: false,
|
|
1234
|
-
mpPlatform:
|
|
1235
|
-
label:
|
|
1234
|
+
mpPlatform: _chunkCFTSVRD4cjs.DEFAULT_MP_PLATFORM,
|
|
1235
|
+
label: _chunkCFTSVRD4cjs.DEFAULT_MP_PLATFORM
|
|
1236
1236
|
};
|
|
1237
1237
|
}
|
|
1238
|
-
const normalized =
|
|
1238
|
+
const normalized = _chunkCFTSVRD4cjs.normalizeMiniPlatform.call(void 0, rawPlatform);
|
|
1239
1239
|
if (!normalized) {
|
|
1240
1240
|
return {
|
|
1241
1241
|
runMini: true,
|
|
1242
1242
|
runWeb: false,
|
|
1243
|
-
mpPlatform:
|
|
1244
|
-
label:
|
|
1243
|
+
mpPlatform: _chunkCFTSVRD4cjs.DEFAULT_MP_PLATFORM,
|
|
1244
|
+
label: _chunkCFTSVRD4cjs.DEFAULT_MP_PLATFORM
|
|
1245
1245
|
};
|
|
1246
1246
|
}
|
|
1247
1247
|
if (normalized === "h5" || normalized === "web") {
|
|
@@ -1252,7 +1252,7 @@ function resolveRuntimeTargets(options) {
|
|
|
1252
1252
|
label: normalized === "h5" ? "h5" : "web"
|
|
1253
1253
|
};
|
|
1254
1254
|
}
|
|
1255
|
-
const mpPlatform =
|
|
1255
|
+
const mpPlatform = _chunkCFTSVRD4cjs.resolveMiniPlatform.call(void 0, normalized);
|
|
1256
1256
|
if (mpPlatform) {
|
|
1257
1257
|
return {
|
|
1258
1258
|
runMini: true,
|
|
@@ -1261,12 +1261,12 @@ function resolveRuntimeTargets(options) {
|
|
|
1261
1261
|
label: mpPlatform
|
|
1262
1262
|
};
|
|
1263
1263
|
}
|
|
1264
|
-
|
|
1264
|
+
_chunkCFTSVRD4cjs.logger_default.warn(`\u672A\u8BC6\u522B\u7684\u5E73\u53F0 "${rawPlatform}"\uFF0C\u5DF2\u56DE\u9000\u5230 ${_chunkCFTSVRD4cjs.DEFAULT_MP_PLATFORM}`);
|
|
1265
1265
|
return {
|
|
1266
1266
|
runMini: true,
|
|
1267
1267
|
runWeb: false,
|
|
1268
|
-
mpPlatform:
|
|
1269
|
-
label:
|
|
1268
|
+
mpPlatform: _chunkCFTSVRD4cjs.DEFAULT_MP_PLATFORM,
|
|
1269
|
+
label: _chunkCFTSVRD4cjs.DEFAULT_MP_PLATFORM
|
|
1270
1270
|
};
|
|
1271
1271
|
}
|
|
1272
1272
|
function createInlineConfig(mpPlatform) {
|
|
@@ -1294,15 +1294,15 @@ function printAnalysisSummary(result) {
|
|
|
1294
1294
|
packageModuleSet.set(pkgRef.packageId, set);
|
|
1295
1295
|
}
|
|
1296
1296
|
}
|
|
1297
|
-
|
|
1297
|
+
_chunkCFTSVRD4cjs.logger_default.success("\u5206\u5305\u5206\u6790\u5B8C\u6210");
|
|
1298
1298
|
for (const pkg of result.packages) {
|
|
1299
1299
|
const chunkCount = pkg.files.filter((file) => file.type === "chunk").length;
|
|
1300
1300
|
const assetCount = pkg.files.length - chunkCount;
|
|
1301
1301
|
const moduleCount = _nullishCoalesce(_optionalChain([packageModuleSet, 'access', _10 => _10.get, 'call', _11 => _11(pkg.id), 'optionalAccess', _12 => _12.size]), () => ( 0));
|
|
1302
|
-
|
|
1302
|
+
_chunkCFTSVRD4cjs.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
1303
|
}
|
|
1304
1304
|
if (result.subPackages.length > 0) {
|
|
1305
|
-
|
|
1305
|
+
_chunkCFTSVRD4cjs.logger_default.info("\u5206\u5305\u914D\u7F6E\uFF1A");
|
|
1306
1306
|
for (const descriptor of result.subPackages) {
|
|
1307
1307
|
const segments = [descriptor.root];
|
|
1308
1308
|
if (descriptor.name) {
|
|
@@ -1311,15 +1311,15 @@ function printAnalysisSummary(result) {
|
|
|
1311
1311
|
if (descriptor.independent) {
|
|
1312
1312
|
segments.push("\u72EC\u7ACB\u6784\u5EFA");
|
|
1313
1313
|
}
|
|
1314
|
-
|
|
1314
|
+
_chunkCFTSVRD4cjs.logger_default.info(`- ${segments.join("\uFF0C")}`);
|
|
1315
1315
|
}
|
|
1316
1316
|
}
|
|
1317
1317
|
const duplicates = result.modules.filter((module) => module.packages.length > 1);
|
|
1318
1318
|
if (duplicates.length === 0) {
|
|
1319
|
-
|
|
1319
|
+
_chunkCFTSVRD4cjs.logger_default.info("\u672A\u68C0\u6D4B\u5230\u8DE8\u5305\u590D\u7528\u7684\u6E90\u7801\u6A21\u5757\u3002");
|
|
1320
1320
|
return;
|
|
1321
1321
|
}
|
|
1322
|
-
|
|
1322
|
+
_chunkCFTSVRD4cjs.logger_default.info(`\u8DE8\u5305\u590D\u7528/\u590D\u5236\u6E90\u7801\u5171 ${duplicates.length} \u9879\uFF1A`);
|
|
1323
1323
|
const limit = 10;
|
|
1324
1324
|
const entries = duplicates.slice(0, limit);
|
|
1325
1325
|
for (const module of entries) {
|
|
@@ -1327,10 +1327,10 @@ function printAnalysisSummary(result) {
|
|
|
1327
1327
|
const label = _nullishCoalesce(packageLabelMap.get(pkgRef.packageId), () => ( pkgRef.packageId));
|
|
1328
1328
|
return `${label} \u2192 ${pkgRef.files.join(", ")}`;
|
|
1329
1329
|
}).join("\uFF1B");
|
|
1330
|
-
|
|
1330
|
+
_chunkCFTSVRD4cjs.logger_default.info(`- ${module.source} (${module.sourceType})\uFF1A${placements}`);
|
|
1331
1331
|
}
|
|
1332
1332
|
if (duplicates.length > limit) {
|
|
1333
|
-
|
|
1333
|
+
_chunkCFTSVRD4cjs.logger_default.info(`- \u2026\u5176\u4F59 ${duplicates.length - limit} \u9879\u8BF7\u4F7F\u7528 \`weapp-vite analyze --json\` \u67E5\u770B`);
|
|
1334
1334
|
}
|
|
1335
1335
|
}
|
|
1336
1336
|
function registerAnalyzeCommand(cli2) {
|
|
@@ -1340,15 +1340,15 @@ function registerAnalyzeCommand(cli2) {
|
|
|
1340
1340
|
const targets = resolveRuntimeTargets(options);
|
|
1341
1341
|
logRuntimeTarget(targets);
|
|
1342
1342
|
if (!targets.runMini) {
|
|
1343
|
-
|
|
1343
|
+
_chunkCFTSVRD4cjs.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
1344
|
return;
|
|
1345
1345
|
}
|
|
1346
1346
|
if (targets.runWeb) {
|
|
1347
|
-
|
|
1347
|
+
_chunkCFTSVRD4cjs.logger_default.warn("\u5206\u6790\u547D\u4EE4\u6682\u4E0D\u652F\u6301 Web \u5E73\u53F0\uFF0C\u5C06\u5FFD\u7565\u76F8\u5173\u914D\u7F6E\u3002");
|
|
1348
1348
|
}
|
|
1349
1349
|
const inlineConfig = createInlineConfig(targets.mpPlatform);
|
|
1350
1350
|
try {
|
|
1351
|
-
const ctx = await
|
|
1351
|
+
const ctx = await _chunk7NTZAAMDcjs.createCompilerContext.call(void 0, {
|
|
1352
1352
|
cwd: root,
|
|
1353
1353
|
mode: _nullishCoalesce(options.mode, () => ( "production")),
|
|
1354
1354
|
configFile,
|
|
@@ -1366,7 +1366,7 @@ function registerAnalyzeCommand(cli2) {
|
|
|
1366
1366
|
await _fsextra2.default.writeFile(resolvedOutputPath, `${JSON.stringify(result, null, 2)}
|
|
1367
1367
|
`, "utf8");
|
|
1368
1368
|
const relativeOutput = configService ? configService.relativeCwd(resolvedOutputPath) : resolvedOutputPath;
|
|
1369
|
-
|
|
1369
|
+
_chunkCFTSVRD4cjs.logger_default.success(`\u5206\u6790\u7ED3\u679C\u5DF2\u5199\u5165 ${relativeOutput}`);
|
|
1370
1370
|
writtenPath = resolvedOutputPath;
|
|
1371
1371
|
}
|
|
1372
1372
|
if (outputJson) {
|
|
@@ -1379,7 +1379,7 @@ function registerAnalyzeCommand(cli2) {
|
|
|
1379
1379
|
await startAnalyzeDashboard(result);
|
|
1380
1380
|
}
|
|
1381
1381
|
} catch (error) {
|
|
1382
|
-
|
|
1382
|
+
_chunkCFTSVRD4cjs.logger_default.error(error);
|
|
1383
1383
|
_process2.default.exitCode = 1;
|
|
1384
1384
|
}
|
|
1385
1385
|
});
|
|
@@ -1537,15 +1537,15 @@ function logBuildAppFinish(configService, webServer, options = {}) {
|
|
|
1537
1537
|
const urls = webServer.resolvedUrls;
|
|
1538
1538
|
const candidates = urls ? [..._nullishCoalesce(urls.local, () => ( [])), ..._nullishCoalesce(urls.network, () => ( []))] : [];
|
|
1539
1539
|
if (candidates.length > 0) {
|
|
1540
|
-
|
|
1540
|
+
_chunkCFTSVRD4cjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8\uFF0C\u6D4F\u89C8\u5668\u8BBF\u95EE\uFF1A");
|
|
1541
1541
|
for (const url of candidates) {
|
|
1542
|
-
|
|
1542
|
+
_chunkCFTSVRD4cjs.logger_default.info(` \u279C ${url}`);
|
|
1543
1543
|
}
|
|
1544
1544
|
} else {
|
|
1545
|
-
|
|
1545
|
+
_chunkCFTSVRD4cjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
|
|
1546
1546
|
}
|
|
1547
1547
|
} else {
|
|
1548
|
-
|
|
1548
|
+
_chunkCFTSVRD4cjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
|
|
1549
1549
|
}
|
|
1550
1550
|
logBuildAppFinishOnlyShowOnce = true;
|
|
1551
1551
|
return;
|
|
@@ -1559,19 +1559,19 @@ function logBuildAppFinish(configService, webServer, options = {}) {
|
|
|
1559
1559
|
args: ["run", "open"]
|
|
1560
1560
|
}));
|
|
1561
1561
|
const devCommand = `${command} ${args.join(" ")}`;
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1562
|
+
_chunkCFTSVRD4cjs.logger_default.success("\u5E94\u7528\u6784\u5EFA\u5B8C\u6210\uFF01\u9884\u89C8\u65B9\u5F0F ( `2` \u79CD\u9009\u5176\u4E00\u5373\u53EF)\uFF1A");
|
|
1563
|
+
_chunkCFTSVRD4cjs.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`);
|
|
1564
|
+
_chunkCFTSVRD4cjs.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
1565
|
if (!skipWeb && webServer) {
|
|
1566
1566
|
const urls = webServer.resolvedUrls;
|
|
1567
1567
|
const candidates = urls ? [..._nullishCoalesce(urls.local, () => ( [])), ..._nullishCoalesce(urls.network, () => ( []))] : [];
|
|
1568
1568
|
if (candidates.length > 0) {
|
|
1569
|
-
|
|
1569
|
+
_chunkCFTSVRD4cjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8\uFF0C\u6D4F\u89C8\u5668\u8BBF\u95EE\uFF1A");
|
|
1570
1570
|
for (const url of candidates) {
|
|
1571
|
-
|
|
1571
|
+
_chunkCFTSVRD4cjs.logger_default.info(` \u279C ${url}`);
|
|
1572
1572
|
}
|
|
1573
1573
|
} else {
|
|
1574
|
-
|
|
1574
|
+
_chunkCFTSVRD4cjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
|
|
1575
1575
|
}
|
|
1576
1576
|
}
|
|
1577
1577
|
logBuildAppFinishOnlyShowOnce = true;
|
|
@@ -1584,7 +1584,7 @@ async function openIde() {
|
|
|
1584
1584
|
try {
|
|
1585
1585
|
await _weappidecli.parse.call(void 0, ["open", "-p"]);
|
|
1586
1586
|
} catch (error) {
|
|
1587
|
-
|
|
1587
|
+
_chunkCFTSVRD4cjs.logger_default.error(error);
|
|
1588
1588
|
}
|
|
1589
1589
|
}
|
|
1590
1590
|
|
|
@@ -1605,7 +1605,7 @@ function registerBuildCommand(cli2) {
|
|
|
1605
1605
|
const targets = resolveRuntimeTargets(options);
|
|
1606
1606
|
logRuntimeTarget(targets);
|
|
1607
1607
|
const inlineConfig = createInlineConfig(targets.mpPlatform);
|
|
1608
|
-
const ctx = await
|
|
1608
|
+
const ctx = await _chunk7NTZAAMDcjs.createCompilerContext.call(void 0, {
|
|
1609
1609
|
cwd: root,
|
|
1610
1610
|
mode: _nullishCoalesce(options.mode, () => ( "production")),
|
|
1611
1611
|
configFile,
|
|
@@ -1625,9 +1625,9 @@ function registerBuildCommand(cli2) {
|
|
|
1625
1625
|
if (targets.runWeb && _optionalChain([webConfig, 'optionalAccess', _14 => _14.enabled])) {
|
|
1626
1626
|
try {
|
|
1627
1627
|
await _optionalChain([webService, 'optionalAccess', _15 => _15.build, 'call', _16 => _16()]);
|
|
1628
|
-
|
|
1628
|
+
_chunkCFTSVRD4cjs.logger_default.success(`Web \u6784\u5EFA\u5B8C\u6210\uFF0C\u8F93\u51FA\u76EE\u5F55\uFF1A${configService.relativeCwd(webConfig.outDir)}`);
|
|
1629
1629
|
} catch (error) {
|
|
1630
|
-
|
|
1630
|
+
_chunkCFTSVRD4cjs.logger_default.error(error);
|
|
1631
1631
|
throw error;
|
|
1632
1632
|
}
|
|
1633
1633
|
}
|
|
@@ -1758,7 +1758,7 @@ async function generate(options) {
|
|
|
1758
1758
|
for (const { code, fileName: fileName2 } of files) {
|
|
1759
1759
|
if (code !== void 0) {
|
|
1760
1760
|
await _fsextra2.default.outputFile(_pathe2.default.resolve(basepath, fileName2), code, "utf8");
|
|
1761
|
-
|
|
1761
|
+
_chunkCFTSVRD4cjs.logger_default.success(`${composePath(outDir, fileName2)} \u521B\u5EFA\u6210\u529F\uFF01`);
|
|
1762
1762
|
}
|
|
1763
1763
|
}
|
|
1764
1764
|
}
|
|
@@ -1780,7 +1780,7 @@ async function loadConfig(configFile) {
|
|
|
1780
1780
|
mode: "development"
|
|
1781
1781
|
};
|
|
1782
1782
|
const loaded = await _vite.loadConfigFromFile.call(void 0, configEnv, resolvedConfigFile, cwd);
|
|
1783
|
-
const weappConfigFilePath = await
|
|
1783
|
+
const weappConfigFilePath = await _chunkCFTSVRD4cjs.resolveWeappConfigFile.call(void 0, {
|
|
1784
1784
|
root: cwd,
|
|
1785
1785
|
specified: resolvedConfigFile
|
|
1786
1786
|
});
|
|
@@ -1833,7 +1833,7 @@ function registerGenerateCommand(cli2) {
|
|
|
1833
1833
|
fileName = "app";
|
|
1834
1834
|
}
|
|
1835
1835
|
if (filepath === void 0) {
|
|
1836
|
-
|
|
1836
|
+
_chunkCFTSVRD4cjs.logger_default.error("weapp-vite generate <outDir> \u547D\u4EE4\u5FC5\u987B\u4F20\u5165\u8DEF\u5F84\u53C2\u6570 outDir");
|
|
1837
1837
|
return;
|
|
1838
1838
|
}
|
|
1839
1839
|
if (options.page) {
|
|
@@ -1861,7 +1861,7 @@ function registerInitCommand(cli2) {
|
|
|
1861
1861
|
command: "weapp-vite"
|
|
1862
1862
|
});
|
|
1863
1863
|
} catch (error) {
|
|
1864
|
-
|
|
1864
|
+
_chunkCFTSVRD4cjs.logger_default.error(error);
|
|
1865
1865
|
}
|
|
1866
1866
|
});
|
|
1867
1867
|
}
|
|
@@ -1874,7 +1874,7 @@ function registerNpmCommand(cli2) {
|
|
|
1874
1874
|
try {
|
|
1875
1875
|
await _weappidecli.parse.call(void 0, ["build-npm", "-p"]);
|
|
1876
1876
|
} catch (error) {
|
|
1877
|
-
|
|
1877
|
+
_chunkCFTSVRD4cjs.logger_default.error(error);
|
|
1878
1878
|
}
|
|
1879
1879
|
});
|
|
1880
1880
|
}
|
|
@@ -1896,7 +1896,7 @@ function registerServeCommand(cli2) {
|
|
|
1896
1896
|
const targets = resolveRuntimeTargets(options);
|
|
1897
1897
|
logRuntimeTarget(targets);
|
|
1898
1898
|
const inlineConfig = createInlineConfig(targets.mpPlatform);
|
|
1899
|
-
const ctx = await
|
|
1899
|
+
const ctx = await _chunk7NTZAAMDcjs.createCompilerContext.call(void 0, {
|
|
1900
1900
|
cwd: root,
|
|
1901
1901
|
mode: _nullishCoalesce(options.mode, () => ( "development")),
|
|
1902
1902
|
isDev: true,
|
|
@@ -1940,7 +1940,7 @@ function registerServeCommand(cli2) {
|
|
|
1940
1940
|
try {
|
|
1941
1941
|
webServer = await _optionalChain([webService, 'optionalAccess', _39 => _39.startDevServer, 'call', _40 => _40()]);
|
|
1942
1942
|
} catch (error) {
|
|
1943
|
-
|
|
1943
|
+
_chunkCFTSVRD4cjs.logger_default.error(error);
|
|
1944
1944
|
throw error;
|
|
1945
1945
|
}
|
|
1946
1946
|
}
|
|
@@ -1961,7 +1961,7 @@ function registerServeCommand(cli2) {
|
|
|
1961
1961
|
// src/cli.ts
|
|
1962
1962
|
var cli = cac("weapp-vite");
|
|
1963
1963
|
try {
|
|
1964
|
-
|
|
1964
|
+
_chunkCFTSVRD4cjs.checkRuntime.call(void 0, {
|
|
1965
1965
|
bun: "0.0.0",
|
|
1966
1966
|
deno: "0.0.0",
|
|
1967
1967
|
node: "20.19.0"
|
|
@@ -1980,5 +1980,5 @@ registerNpmCommand(cli);
|
|
|
1980
1980
|
registerGenerateCommand(cli);
|
|
1981
1981
|
registerCreateCommand(cli);
|
|
1982
1982
|
cli.help();
|
|
1983
|
-
cli.version(
|
|
1983
|
+
cli.version(_chunkCFTSVRD4cjs.VERSION);
|
|
1984
1984
|
cli.parse();
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCompilerContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7HMGYHVJ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
DEFAULT_MP_PLATFORM,
|
|
6
6
|
SHARED_CHUNK_VIRTUAL_PREFIX,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
normalizeMiniPlatform,
|
|
12
12
|
resolveMiniPlatform,
|
|
13
13
|
resolveWeappConfigFile
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-JCCRRTKA.mjs";
|
|
15
15
|
import {
|
|
16
16
|
init_esm_shims
|
|
17
17
|
} from "./chunk-TZWATIK3.mjs";
|