weapp-vite 6.6.4 → 6.6.6
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.mjs +1 -1
- package/dist/{chunk-5V5BMEO4.mjs → chunk-5BXQZS45.mjs} +143 -102
- package/dist/{chunk-MNX46VWR.mjs → chunk-VUALEZY3.mjs} +1 -1
- package/dist/cli.mjs +141 -68
- package/dist/{config-BDp-nhap.d.ts → config-CdeM_u7y.d.ts} +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/json.d.ts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +4 -3
package/dist/auto-routes.mjs
CHANGED
|
@@ -1366,8 +1366,8 @@ import process2 from "process";
|
|
|
1366
1366
|
|
|
1367
1367
|
// src/logger.ts
|
|
1368
1368
|
init_esm_shims();
|
|
1369
|
-
import
|
|
1370
|
-
|
|
1369
|
+
import { default as default2 } from "@weapp-core/logger";
|
|
1370
|
+
import { colors, configureLogger } from "@weapp-core/logger";
|
|
1371
1371
|
|
|
1372
1372
|
// src/utils/version.ts
|
|
1373
1373
|
function getRuntime() {
|
|
@@ -1396,14 +1396,14 @@ function checkRuntime(minVersions) {
|
|
|
1396
1396
|
const { runtime, version: version2 } = getRuntime();
|
|
1397
1397
|
const required = minVersions[runtime];
|
|
1398
1398
|
if (!required) {
|
|
1399
|
-
|
|
1399
|
+
default2.warn(`\u672A\u4E3A ${runtime} \u6307\u5B9A\u6700\u4F4E\u7248\u672C\uFF0C\u5DF2\u8DF3\u8FC7\u68C0\u67E5\u3002`);
|
|
1400
1400
|
return;
|
|
1401
1401
|
}
|
|
1402
1402
|
const isPlainVersion = Boolean((0, import_valid.default)(required));
|
|
1403
1403
|
const isSatisfied = isPlainVersion ? (0, import_gte.default)(version2, required) : (0, import_satisfies.default)(version2, required);
|
|
1404
1404
|
if (!isSatisfied) {
|
|
1405
1405
|
const expected = isPlainVersion ? `>= ${required}` : required;
|
|
1406
|
-
|
|
1406
|
+
default2.warn(`\u5F53\u524D ${runtime} \u7248\u672C\u4E3A ${version2} \u65E0\u6CD5\u6EE1\u8DB3 \`weapp-vite\` \u6700\u4F4E\u8981\u6C42\u7684\u7248\u672C(${expected})`);
|
|
1407
1407
|
}
|
|
1408
1408
|
}
|
|
1409
1409
|
|
|
@@ -1413,7 +1413,6 @@ init_esm_shims();
|
|
|
1413
1413
|
// src/utils/babel.ts
|
|
1414
1414
|
init_esm_shims();
|
|
1415
1415
|
import { createRequire } from "module";
|
|
1416
|
-
import { parse } from "@babel/parser";
|
|
1417
1416
|
var BABEL_TS_MODULE_PLUGINS = [
|
|
1418
1417
|
"typescript",
|
|
1419
1418
|
"decorators-legacy",
|
|
@@ -1429,6 +1428,7 @@ var BABEL_TS_MODULE_PARSER_OPTIONS = {
|
|
|
1429
1428
|
var nodeRequire = createRequire(import.meta.url);
|
|
1430
1429
|
var cachedTraverse;
|
|
1431
1430
|
var cachedGenerate;
|
|
1431
|
+
var cachedParse;
|
|
1432
1432
|
function requireCallableDefault(id) {
|
|
1433
1433
|
const mod = nodeRequire(id);
|
|
1434
1434
|
if (typeof mod === "function") {
|
|
@@ -1454,12 +1454,21 @@ function getGenerate() {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
return cachedGenerate;
|
|
1456
1456
|
}
|
|
1457
|
+
function getParse() {
|
|
1458
|
+
if (!cachedParse) {
|
|
1459
|
+
cachedParse = nodeRequire("@babel/parser").parse;
|
|
1460
|
+
}
|
|
1461
|
+
return cachedParse;
|
|
1462
|
+
}
|
|
1457
1463
|
var traverse = (...args) => {
|
|
1458
1464
|
return getTraverse()(...args);
|
|
1459
1465
|
};
|
|
1460
1466
|
var generate = (...args) => {
|
|
1461
1467
|
return getGenerate()(...args);
|
|
1462
1468
|
};
|
|
1469
|
+
var parse = ((...args) => {
|
|
1470
|
+
return getParse()(...args);
|
|
1471
|
+
});
|
|
1463
1472
|
function getVisitorKeys() {
|
|
1464
1473
|
return nodeRequire("@babel/types").VISITOR_KEYS;
|
|
1465
1474
|
}
|
|
@@ -3831,14 +3840,14 @@ function createMetadataHelpers(state) {
|
|
|
3831
3840
|
const raw = fs5.readJsonSync(candidate);
|
|
3832
3841
|
metadata = extractJsonPropMetadata(raw);
|
|
3833
3842
|
if (metadata.props.size > 0 || metadata.docs.size > 0) {
|
|
3834
|
-
|
|
3843
|
+
default2.debug?.(`[auto-import] loaded metadata for ${name} from ${candidate}`);
|
|
3835
3844
|
break;
|
|
3836
3845
|
}
|
|
3837
3846
|
} catch {
|
|
3838
3847
|
}
|
|
3839
3848
|
}
|
|
3840
3849
|
}
|
|
3841
|
-
|
|
3850
|
+
default2.debug?.(`[auto-import] metadata for ${name}: props=${metadata.props.size} docs=${metadata.docs.size}`);
|
|
3842
3851
|
return {
|
|
3843
3852
|
types: new Map(metadata.props),
|
|
3844
3853
|
docs: new Map(metadata.docs)
|
|
@@ -3985,7 +3994,7 @@ function createScheduleHelpers(options) {
|
|
|
3985
3994
|
await writeManifest(outputPath);
|
|
3986
3995
|
} catch (error) {
|
|
3987
3996
|
const message = error instanceof Error ? error.message : String(error);
|
|
3988
|
-
|
|
3997
|
+
default2.error(`\u81EA\u52A8\u5BFC\u51FA\u7EC4\u4EF6\u6E05\u5355\u5931\u8D25: ${message}`);
|
|
3989
3998
|
}
|
|
3990
3999
|
}
|
|
3991
4000
|
}).finally(() => {
|
|
@@ -7200,7 +7209,7 @@ async function syncTypedComponentsDefinition(settings, options) {
|
|
|
7200
7209
|
outputsState.lastTypedDefinitionOutputPath = settings.outputPath;
|
|
7201
7210
|
} catch (error) {
|
|
7202
7211
|
const message = error instanceof Error ? error.message : String(error);
|
|
7203
|
-
|
|
7212
|
+
default2.error(`\u5199\u5165 typed-components.d.ts \u5931\u8D25: ${message}`);
|
|
7204
7213
|
}
|
|
7205
7214
|
}
|
|
7206
7215
|
async function syncVueComponentsDefinition(settings, options) {
|
|
@@ -7255,7 +7264,7 @@ async function syncVueComponentsDefinition(settings, options) {
|
|
|
7255
7264
|
outputsState.lastVueComponentsOutputPath = settings.outputPath;
|
|
7256
7265
|
} catch (error) {
|
|
7257
7266
|
const message = error instanceof Error ? error.message : String(error);
|
|
7258
|
-
|
|
7267
|
+
default2.error(`\u5199\u5165 components.d.ts \u5931\u8D25: ${message}`);
|
|
7259
7268
|
}
|
|
7260
7269
|
}
|
|
7261
7270
|
async function syncHtmlCustomData(settings, options) {
|
|
@@ -7291,7 +7300,7 @@ async function syncHtmlCustomData(settings, options) {
|
|
|
7291
7300
|
outputsState.lastHtmlCustomDataOutputPath = settings.outputPath;
|
|
7292
7301
|
} catch (error) {
|
|
7293
7302
|
const message = error instanceof Error ? error.message : String(error);
|
|
7294
|
-
|
|
7303
|
+
default2.error(`\u5199\u5165 mini-program.html-data.json \u5931\u8D25: ${message}`);
|
|
7295
7304
|
}
|
|
7296
7305
|
}
|
|
7297
7306
|
|
|
@@ -7514,7 +7523,7 @@ function createRegistryHelpers(state) {
|
|
|
7514
7523
|
propMap = mergePropMaps(baseProps, props);
|
|
7515
7524
|
} catch (error) {
|
|
7516
7525
|
const message = error instanceof Error ? error.message : String(error);
|
|
7517
|
-
|
|
7526
|
+
default2.error(`\u89E3\u6790\u7EC4\u4EF6 \`${state.ctx.configService.relativeCwd(resolvedJsEntry)}\` \u5C5E\u6027\u5931\u8D25: ${message}`);
|
|
7518
7527
|
propMap = new Map(baseProps);
|
|
7519
7528
|
}
|
|
7520
7529
|
}
|
|
@@ -7752,7 +7761,7 @@ function logWarnOnce(message) {
|
|
|
7752
7761
|
if (logWarnCache.get(message)) {
|
|
7753
7762
|
return;
|
|
7754
7763
|
}
|
|
7755
|
-
|
|
7764
|
+
default2.warn(message);
|
|
7756
7765
|
logWarnCache.set(message, true);
|
|
7757
7766
|
}
|
|
7758
7767
|
function createAutoImportService(ctx) {
|
|
@@ -8069,52 +8078,59 @@ init_esm_shims();
|
|
|
8069
8078
|
|
|
8070
8079
|
// src/runtime/autoRoutesPlugin/routes/format.ts
|
|
8071
8080
|
init_esm_shims();
|
|
8072
|
-
|
|
8081
|
+
var INDENT = " ";
|
|
8082
|
+
function formatTuple(values, baseIndent = "") {
|
|
8073
8083
|
if (values.length === 0) {
|
|
8074
|
-
return "
|
|
8084
|
+
return "[]";
|
|
8075
8085
|
}
|
|
8076
|
-
const indent = `${baseIndent}
|
|
8086
|
+
const indent = `${baseIndent}${INDENT}`;
|
|
8077
8087
|
const lines = values.map((value) => `${indent}${JSON.stringify(value)}`);
|
|
8078
|
-
return `
|
|
8088
|
+
return `[
|
|
8079
8089
|
${lines.join(",\n")}
|
|
8080
8090
|
${baseIndent}]`;
|
|
8081
8091
|
}
|
|
8082
|
-
function
|
|
8092
|
+
function formatSubPackagesTuple(subPackages, baseIndent = "") {
|
|
8083
8093
|
if (subPackages.length === 0) {
|
|
8084
|
-
return "
|
|
8094
|
+
return "[]";
|
|
8085
8095
|
}
|
|
8086
|
-
const lines = ["
|
|
8096
|
+
const lines = ["["];
|
|
8097
|
+
const objectIndent = `${baseIndent}${INDENT}`;
|
|
8098
|
+
const fieldIndent = `${objectIndent}${INDENT}`;
|
|
8087
8099
|
subPackages.forEach((pkg, index) => {
|
|
8088
|
-
lines.push(
|
|
8089
|
-
lines.push(
|
|
8090
|
-
const pages =
|
|
8091
|
-
lines.push(
|
|
8092
|
-
lines.push(
|
|
8100
|
+
lines.push(`${objectIndent}{`);
|
|
8101
|
+
lines.push(`${fieldIndent}readonly root: ${JSON.stringify(pkg.root)};`);
|
|
8102
|
+
const pages = formatTuple(pkg.pages, fieldIndent);
|
|
8103
|
+
lines.push(`${fieldIndent}readonly pages: ${pages};`);
|
|
8104
|
+
lines.push(`${objectIndent}}${index < subPackages.length - 1 ? "," : ""}`);
|
|
8093
8105
|
});
|
|
8094
|
-
lines.push(
|
|
8106
|
+
lines.push(`${baseIndent}]`);
|
|
8095
8107
|
return lines.join("\n");
|
|
8096
8108
|
}
|
|
8097
8109
|
function createTypedRouterDefinition(routes) {
|
|
8098
|
-
const pagesType =
|
|
8099
|
-
const entriesType =
|
|
8100
|
-
const subPackagesType =
|
|
8110
|
+
const pagesType = formatTuple(routes.pages, INDENT);
|
|
8111
|
+
const entriesType = formatTuple(routes.entries, INDENT);
|
|
8112
|
+
const subPackagesType = formatSubPackagesTuple(routes.subPackages, INDENT);
|
|
8101
8113
|
return [
|
|
8114
|
+
"/* eslint-disable */",
|
|
8115
|
+
"// biome-ignore lint: disable",
|
|
8116
|
+
"// oxlint-disable",
|
|
8117
|
+
"// ------",
|
|
8102
8118
|
"// \u7531 weapp-vite \u81EA\u52A8\u751F\u6210\uFF0C\u8BF7\u52FF\u7F16\u8F91\u3002",
|
|
8103
8119
|
"declare module 'weapp-vite/auto-routes' {",
|
|
8104
|
-
`
|
|
8105
|
-
`
|
|
8106
|
-
`
|
|
8107
|
-
"
|
|
8108
|
-
"
|
|
8109
|
-
"
|
|
8110
|
-
"
|
|
8111
|
-
"
|
|
8112
|
-
"
|
|
8113
|
-
"
|
|
8114
|
-
"
|
|
8115
|
-
"
|
|
8116
|
-
"
|
|
8117
|
-
"
|
|
8120
|
+
` export type AutoRoutesPages = ${pagesType};`,
|
|
8121
|
+
` export type AutoRoutesEntries = ${entriesType};`,
|
|
8122
|
+
` export type AutoRoutesSubPackages = ${subPackagesType};`,
|
|
8123
|
+
" export type AutoRoutesSubPackage = AutoRoutesSubPackages[number];",
|
|
8124
|
+
" export interface AutoRoutes {",
|
|
8125
|
+
" readonly pages: AutoRoutesPages;",
|
|
8126
|
+
" readonly entries: AutoRoutesEntries;",
|
|
8127
|
+
" readonly subPackages: AutoRoutesSubPackages;",
|
|
8128
|
+
" }",
|
|
8129
|
+
" export const routes: AutoRoutes;",
|
|
8130
|
+
" export const pages: AutoRoutesPages;",
|
|
8131
|
+
" export const entries: AutoRoutesEntries;",
|
|
8132
|
+
" export const subPackages: AutoRoutesSubPackages;",
|
|
8133
|
+
" export default routes;",
|
|
8118
8134
|
"}",
|
|
8119
8135
|
""
|
|
8120
8136
|
].join("\n");
|
|
@@ -8513,7 +8529,7 @@ function createAutoRoutesService(ctx) {
|
|
|
8513
8529
|
lastWrittenTypedDefinition = nextContent;
|
|
8514
8530
|
} catch (error) {
|
|
8515
8531
|
const message = error instanceof Error ? error.message : String(error);
|
|
8516
|
-
|
|
8532
|
+
default2.error(`\u5199\u5165 typed-router.d.ts \u5931\u8D25: ${message}`);
|
|
8517
8533
|
}
|
|
8518
8534
|
}
|
|
8519
8535
|
async function removeTypedRouterDefinition() {
|
|
@@ -8529,7 +8545,7 @@ function createAutoRoutesService(ctx) {
|
|
|
8529
8545
|
lastWrittenTypedDefinition = void 0;
|
|
8530
8546
|
} catch (error) {
|
|
8531
8547
|
const message = error instanceof Error ? error.message : String(error);
|
|
8532
|
-
|
|
8548
|
+
default2.error(`\u79FB\u9664 typed-router.d.ts \u5931\u8D25: ${message}`);
|
|
8533
8549
|
}
|
|
8534
8550
|
}
|
|
8535
8551
|
function markNeedsFullRescan() {
|
|
@@ -17639,7 +17655,7 @@ function createSharedPathResolver(configService, sharedPathRoot) {
|
|
|
17639
17655
|
const configuredRoot = sharedPathRoot ? path30.resolve(configService.cwd, sharedPathRoot) : absoluteSrcRoot;
|
|
17640
17656
|
const resolvedRoot = isPathInside(absoluteSrcRoot, configuredRoot) ? configuredRoot : absoluteSrcRoot;
|
|
17641
17657
|
if (configuredRoot !== resolvedRoot) {
|
|
17642
|
-
|
|
17658
|
+
default2.warn(
|
|
17643
17659
|
`[chunks] sharedPathRoot "${sharedPathRoot}" \u4E0D\u5728 srcRoot \u5185\uFF0C\u5DF2\u56DE\u9000\u5230 srcRoot\u3002`
|
|
17644
17660
|
);
|
|
17645
17661
|
}
|
|
@@ -17891,7 +17907,7 @@ function createIndependentBuilder(configService, buildState) {
|
|
|
17891
17907
|
} catch (error) {
|
|
17892
17908
|
const normalized = createIndependentBuildError(root, error);
|
|
17893
17909
|
invalidateIndependentOutput(root);
|
|
17894
|
-
|
|
17910
|
+
default2.error(`[\u72EC\u7ACB\u5206\u5305] ${root} \u6784\u5EFA\u5931\u8D25\uFF1A${normalized.message}`);
|
|
17895
17911
|
throw normalized;
|
|
17896
17912
|
} finally {
|
|
17897
17913
|
independentBuildTasks.delete(root);
|
|
@@ -23860,7 +23876,7 @@ async function cleanOutputs(configService) {
|
|
|
23860
23876
|
}
|
|
23861
23877
|
);
|
|
23862
23878
|
debug?.("deletedFilePaths", deletedFilePaths);
|
|
23863
|
-
|
|
23879
|
+
default2.success(`\u5DF2\u6E05\u7A7A ${configService.mpDistRoot} \u76EE\u5F55`);
|
|
23864
23880
|
}
|
|
23865
23881
|
const pluginOutputRoot = configService.absolutePluginOutputRoot;
|
|
23866
23882
|
if (pluginOutputRoot) {
|
|
@@ -23874,7 +23890,7 @@ async function cleanOutputs(configService) {
|
|
|
23874
23890
|
glob: true
|
|
23875
23891
|
});
|
|
23876
23892
|
debug?.("deletedPluginOutput", deletedPluginFiles);
|
|
23877
|
-
|
|
23893
|
+
default2.success(`\u5DF2\u6E05\u7A7A ${configService.relativeCwd(pluginOutputRoot)} \u76EE\u5F55`);
|
|
23878
23894
|
}
|
|
23879
23895
|
}
|
|
23880
23896
|
}
|
|
@@ -25664,8 +25680,8 @@ function checkWorkersOptions(target, configService, scanService) {
|
|
|
25664
25680
|
const workersDir = scanService.workersDir;
|
|
25665
25681
|
const hasWorkersDir = Boolean(workersDir);
|
|
25666
25682
|
if (hasWorkersDir && configService.weappViteConfig?.worker?.entry === void 0) {
|
|
25667
|
-
|
|
25668
|
-
|
|
25683
|
+
default2.error("\u68C0\u6D4B\u5230\u5DF2\u7ECF\u5F00\u542F\u4E86 `worker`\uFF0C\u8BF7\u5728 `vite.config.ts` \u4E2D\u8BBE\u7F6E `weapp.worker.entry` \u8DEF\u5F84");
|
|
25684
|
+
default2.error("\u6BD4\u5982\u5F15\u5165\u7684 `worker` \u8DEF\u5F84\u4E3A `workers/index`, \u6B64\u65F6 `weapp.worker.entry` \u8BBE\u7F6E\u4E3A `[index]` ");
|
|
25669
25685
|
throw new Error("\u8BF7\u5728 `vite.config.ts` \u4E2D\u8BBE\u7F6E `weapp.worker.entry` \u8DEF\u5F84");
|
|
25670
25686
|
}
|
|
25671
25687
|
return {
|
|
@@ -25700,9 +25716,9 @@ function watchWorkers(configService, watcherService, workersDir) {
|
|
|
25700
25716
|
const relative3 = configService.relativeCwd(targetPath);
|
|
25701
25717
|
const message = `[workers:${type}] ${relative3}`;
|
|
25702
25718
|
if (level === "success") {
|
|
25703
|
-
|
|
25719
|
+
default2.success(message);
|
|
25704
25720
|
} else {
|
|
25705
|
-
|
|
25721
|
+
default2.info(message);
|
|
25706
25722
|
}
|
|
25707
25723
|
};
|
|
25708
25724
|
workerWatcher.on("all", (event, id) => {
|
|
@@ -25804,7 +25820,7 @@ function createBuildService(ctx) {
|
|
|
25804
25820
|
if (e.code === "START") {
|
|
25805
25821
|
startTime = performance.now();
|
|
25806
25822
|
} else if (e.code === "END") {
|
|
25807
|
-
|
|
25823
|
+
default2.success(`\u6784\u5EFA\u5B8C\u6210\uFF0C\u8017\u65F6 ${(performance.now() - startTime).toFixed(2)} ms`);
|
|
25808
25824
|
if (appWxssPath && shouldTouchAppWxss()) {
|
|
25809
25825
|
void touch(appWxssPath).catch(() => {
|
|
25810
25826
|
});
|
|
@@ -26322,7 +26338,7 @@ function createOxcRuntimeSupport() {
|
|
|
26322
26338
|
if (helperName) {
|
|
26323
26339
|
const helperPath = id.startsWith(NULL_BYTE) ? path37.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`) : id;
|
|
26324
26340
|
if (await fs18.pathExists(helperPath)) {
|
|
26325
|
-
|
|
26341
|
+
default2.warn(`[weapp-vite] \u901A\u8FC7 Rolldown \u63D2\u4EF6\u89E3\u6790 oxc helper\uFF1A${helperName}`);
|
|
26326
26342
|
return fs18.readFile(helperPath, "utf8");
|
|
26327
26343
|
}
|
|
26328
26344
|
const fallback = fallbackHelpers[helperName];
|
|
@@ -26341,7 +26357,7 @@ function createOxcRuntimeSupport() {
|
|
|
26341
26357
|
return null;
|
|
26342
26358
|
}
|
|
26343
26359
|
if (source.includes("@oxc-project/runtime/helpers")) {
|
|
26344
|
-
|
|
26360
|
+
default2.warn(`[weapp-vite] resolveId \u5DF2\u62E6\u622A\uFF1A${source}`);
|
|
26345
26361
|
}
|
|
26346
26362
|
const helperName = getOxcHelperName(source);
|
|
26347
26363
|
if (helperName) {
|
|
@@ -26358,7 +26374,7 @@ function createOxcRuntimeSupport() {
|
|
|
26358
26374
|
return null;
|
|
26359
26375
|
}
|
|
26360
26376
|
const helperPath = path37.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`);
|
|
26361
|
-
|
|
26377
|
+
default2.warn(`[weapp-vite] \u901A\u8FC7 Vite \u63D2\u4EF6\u89E3\u6790 oxc helper\uFF1A${helperName}`);
|
|
26362
26378
|
return fs18.readFile(helperPath, "utf8");
|
|
26363
26379
|
}
|
|
26364
26380
|
};
|
|
@@ -26557,7 +26573,7 @@ function migrateEnhanceOptions(target, options) {
|
|
|
26557
26573
|
}
|
|
26558
26574
|
if (options.warn && !hasLoggedEnhanceDeprecation) {
|
|
26559
26575
|
hasLoggedEnhanceDeprecation = true;
|
|
26560
|
-
|
|
26576
|
+
default2.warn("`weapp.enhance` \u5DF2\u5E9F\u5F03\uFF0C\u5C06\u5728 weapp-vite@6 \u79FB\u9664\uFF0C\u8BF7\u6539\u7528\u9876\u5C42\u7684 `weapp.wxml`\u3001`weapp.wxs` \u4E0E `weapp.autoImportComponents`\u3002");
|
|
26561
26577
|
}
|
|
26562
26578
|
}
|
|
26563
26579
|
|
|
@@ -28098,9 +28114,9 @@ async function emitEntryOutput(options) {
|
|
|
28098
28114
|
for (const { entry, resolvedId } of combinedResolved) {
|
|
28099
28115
|
if (!resolvedId) {
|
|
28100
28116
|
if (pluginEntrySet?.has(entry)) {
|
|
28101
|
-
|
|
28117
|
+
default2.warn(`\u6CA1\u6709\u627E\u5230\u63D2\u4EF6\u5165\u53E3 \`${entry}\` \u5BF9\u5E94\u7684\u811A\u672C\u6587\u4EF6\uFF0C\u8BF7\u68C0\u67E5\u8DEF\u5F84\u662F\u5426\u6B63\u786E!`);
|
|
28102
28118
|
} else {
|
|
28103
|
-
|
|
28119
|
+
default2.warn(`\u6CA1\u6709\u627E\u5230 \`${entry}\` \u7684\u5165\u53E3\u6587\u4EF6\uFF0C\u8BF7\u68C0\u67E5\u8DEF\u5F84\u662F\u5426\u6B63\u786E!`);
|
|
28104
28120
|
}
|
|
28105
28121
|
continue;
|
|
28106
28122
|
}
|
|
@@ -28363,7 +28379,7 @@ async function applyScriptSetupUsingComponents(options) {
|
|
|
28363
28379
|
continue;
|
|
28364
28380
|
}
|
|
28365
28381
|
if (Reflect.has(usingComponents, localName) && usingComponents[localName] !== from) {
|
|
28366
|
-
|
|
28382
|
+
default2.warn(
|
|
28367
28383
|
`[\u81EA\u52A8 usingComponents] \u51B2\u7A81\uFF1A${vueEntryPath} \u4E2D usingComponents['${localName}']='${usingComponents[localName]}' \u5C06\u88AB <script setup> \u5BFC\u5165\u8986\u76D6\u4E3A '${from}'`
|
|
28368
28384
|
);
|
|
28369
28385
|
}
|
|
@@ -28375,7 +28391,7 @@ async function applyScriptSetupUsingComponents(options) {
|
|
|
28375
28391
|
}
|
|
28376
28392
|
} catch (error) {
|
|
28377
28393
|
const message = error instanceof Error ? error.message : String(error);
|
|
28378
|
-
|
|
28394
|
+
default2.warn(`[\u81EA\u52A8 usingComponents] \u89E3\u6790\u5931\u8D25\uFF1A${vueEntryPath}\uFF1A${message}`);
|
|
28379
28395
|
}
|
|
28380
28396
|
}
|
|
28381
28397
|
|
|
@@ -29792,9 +29808,9 @@ function createGenerateBundleHook(state, isPluginBuild) {
|
|
|
29792
29808
|
}
|
|
29793
29809
|
const subPackageList = Array.from(subPackageSet).join("\u3001") || "\u76F8\u5173\u5206\u5305";
|
|
29794
29810
|
const ignoredHint = ignoredMainImporters?.length ? `\uFF0C\u5FFD\u7565\u4E3B\u5305\u5F15\u7528\uFF1A${ignoredMainImporters.join("\u3001")}` : "";
|
|
29795
|
-
|
|
29811
|
+
default2.info(`[\u5206\u5305] \u5206\u5305 ${subPackageList} \u5171\u4EAB\u6A21\u5757\u5DF2\u590D\u5236\u5230\u5404\u81EA weapp-shared/common.js\uFF08${totalReferences} \u5904\u5F15\u7528${ignoredHint}\uFF09`);
|
|
29796
29812
|
if (retainedInMain) {
|
|
29797
|
-
|
|
29813
|
+
default2.warn(`[\u5206\u5305] \u6A21\u5757 ${sharedFileName} \u540C\u65F6\u88AB\u4E3B\u5305\u5F15\u7528\uFF0C\u56E0\u6B64\u4ECD\u4FDD\u7559\u5728\u4E3B\u5305 common.js\uFF0C\u5E76\u590D\u5236\u5230 ${subPackageList}\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u9700\u8981\u5C06\u6E90\u4EE3\u7801\u79FB\u52A8\u5230\u4E3B\u5305\u6216\u516C\u5171\u76EE\u5F55\u3002`);
|
|
29798
29814
|
}
|
|
29799
29815
|
}
|
|
29800
29816
|
} : void 0;
|
|
@@ -29823,14 +29839,14 @@ function createGenerateBundleHook(state, isPluginBuild) {
|
|
|
29823
29839
|
const scope = segments.join("\u3001") || "\u4E3B\u5305";
|
|
29824
29840
|
const sharedChunkLabel = resolveSharedChunkLabel(sharedFileName, finalFileName);
|
|
29825
29841
|
if (reason === "main-package") {
|
|
29826
|
-
|
|
29842
|
+
default2.info(`[\u5206\u5305] ${scope} \u5171\u4EAB\u6A21\u5757 ${sharedChunkLabel}\uFF08${importers.length} \u5904\u5F15\u7528\uFF09\u5DF2\u63D0\u5347\u5230\u4E3B\u5305 common.js`);
|
|
29827
29843
|
} else {
|
|
29828
|
-
|
|
29844
|
+
default2.info(`[\u5206\u5305] \u4EC5\u4E3B\u5305\u4F7F\u7528\u5171\u4EAB\u6A21\u5757 ${sharedChunkLabel}\uFF08${importers.length} \u5904\u5F15\u7528\uFF09\uFF0C\u4FDD\u7559\u5728\u4E3B\u5305 common.js`);
|
|
29829
29845
|
}
|
|
29830
29846
|
} : void 0
|
|
29831
29847
|
});
|
|
29832
29848
|
if (shouldWarnOnDuplicate && redundantBytesTotal > duplicateWarningBytes) {
|
|
29833
|
-
|
|
29849
|
+
default2.warn(`[\u5206\u5305] \u5206\u5305\u590D\u5236\u5171\u4EAB\u6A21\u5757\u4EA7\u751F\u5197\u4F59\u4F53\u79EF ${formatBytes(redundantBytesTotal)}\uFF0C\u5DF2\u8D85\u8FC7\u9608\u503C ${formatBytes(duplicateWarningBytes)}\uFF0C\u5EFA\u8BAE\u8C03\u6574\u5206\u5305\u5212\u5206\u6216\u8FD0\u884C weapp-vite analyze \u5B9A\u4F4D\u95EE\u9898\u3002`);
|
|
29834
29850
|
}
|
|
29835
29851
|
}
|
|
29836
29852
|
removeImplicitPagePreloads(rolldownBundle, {
|
|
@@ -30116,7 +30132,7 @@ ${transformedCode}`;
|
|
|
30116
30132
|
}
|
|
30117
30133
|
const resolved = await pluginCtx.resolve("@wevu/api", importer);
|
|
30118
30134
|
if (!resolved) {
|
|
30119
|
-
|
|
30135
|
+
default2.warn("[weapp-vite] \u672A\u627E\u5230 @wevu/api\uFF0C\u5DF2\u8DF3\u8FC7 wpi \u5168\u5C40\u6CE8\u5165\u3002");
|
|
30120
30136
|
weapiResolution.available = false;
|
|
30121
30137
|
return false;
|
|
30122
30138
|
}
|
|
@@ -30807,7 +30823,7 @@ async function invalidateEntryForSidecar(ctx, filePath, event = "update") {
|
|
|
30807
30823
|
}
|
|
30808
30824
|
if (!touchedTargets.size && !touchedScripts.size) {
|
|
30809
30825
|
if (event === "create" && (isCssSidecar || isTemplateSidecar)) {
|
|
30810
|
-
|
|
30826
|
+
default2.info(`[sidecar:${event}] ${relativeSource} \u65B0\u589E\uFF0C\u4F46\u672A\u627E\u5230\u5F15\u7528\u65B9\uFF0C\u7B49\u5F85\u540E\u7EED\u5173\u8054`);
|
|
30811
30827
|
}
|
|
30812
30828
|
return;
|
|
30813
30829
|
}
|
|
@@ -30819,7 +30835,7 @@ async function invalidateEntryForSidecar(ctx, filePath, event = "update") {
|
|
|
30819
30835
|
touchedList.push(configService.relativeCwd(script));
|
|
30820
30836
|
}
|
|
30821
30837
|
const uniqueTouched = Array.from(new Set(touchedList));
|
|
30822
|
-
|
|
30838
|
+
default2.success(`[sidecar:${event}] ${relativeSource} -> \u5237\u65B0 ${uniqueTouched.join(", ")}`);
|
|
30823
30839
|
}
|
|
30824
30840
|
|
|
30825
30841
|
// src/plugins/utils/invalidateEntry/watcher.ts
|
|
@@ -30885,7 +30901,7 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
30885
30901
|
}
|
|
30886
30902
|
const normalizedPath = path57.normalize(input);
|
|
30887
30903
|
if (!options?.silent) {
|
|
30888
|
-
|
|
30904
|
+
default2.info(`[watch:${event}] ${ctx.configService.relativeCwd(normalizedPath)}`);
|
|
30889
30905
|
}
|
|
30890
30906
|
handleSidecarChange(event, normalizedPath, isReady);
|
|
30891
30907
|
};
|
|
@@ -30908,7 +30924,7 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
30908
30924
|
const exists = fs26.existsSync(resolved);
|
|
30909
30925
|
const derivedEvent = exists ? "create" : "delete";
|
|
30910
30926
|
const relativeResolved = ctx.configService.relativeCwd(resolved);
|
|
30911
|
-
|
|
30927
|
+
default2.info(`[watch:rename->${derivedEvent}] ${relativeResolved}`);
|
|
30912
30928
|
forwardChange(derivedEvent, resolved, { silent: true });
|
|
30913
30929
|
});
|
|
30914
30930
|
watcher.on("ready", () => {
|
|
@@ -30920,7 +30936,7 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
30920
30936
|
}
|
|
30921
30937
|
const relativeRoot = ctx.configService.relativeCwd(absRoot);
|
|
30922
30938
|
const code = error?.code ?? "UNKNOWN";
|
|
30923
|
-
|
|
30939
|
+
default2.warn(`[\u76D1\u542C] ${relativeRoot} \u76D1\u542C\u6570\u91CF\u8FBE\u5230\u4E0A\u9650 (${code})\uFF0C\u4FA7\u8F66\u6587\u4EF6\u76D1\u542C\u5DF2\u505C\u7528`);
|
|
30924
30940
|
});
|
|
30925
30941
|
sidecarWatcherMap.set(absRoot, {
|
|
30926
30942
|
close: () => void watcher.close()
|
|
@@ -31061,9 +31077,9 @@ function createWatchChangeHook(state) {
|
|
|
31061
31077
|
if (subPackageMeta.watchSharedStyles !== false) {
|
|
31062
31078
|
invalidateSharedStyleCache();
|
|
31063
31079
|
}
|
|
31064
|
-
|
|
31080
|
+
default2.success(`[${change.event}] ${configService.relativeCwd(normalizedId)} --[\u72EC\u7ACB\u5206\u5305 ${subPackageMeta.subPackage.root}]`);
|
|
31065
31081
|
} else if (!handledByIndependentWatcher) {
|
|
31066
|
-
|
|
31082
|
+
default2.success(`[${change.event}] ${configService.relativeCwd(normalizedId)}`);
|
|
31067
31083
|
}
|
|
31068
31084
|
};
|
|
31069
31085
|
}
|
|
@@ -31138,7 +31154,7 @@ function createRequireAnalysisPlugin(state) {
|
|
|
31138
31154
|
meta: { requireTokens }
|
|
31139
31155
|
};
|
|
31140
31156
|
} catch (error) {
|
|
31141
|
-
|
|
31157
|
+
default2.error(error);
|
|
31142
31158
|
}
|
|
31143
31159
|
}
|
|
31144
31160
|
},
|
|
@@ -31781,7 +31797,7 @@ function ensureWevuInstalled(ctx) {
|
|
|
31781
31797
|
} catch {
|
|
31782
31798
|
warnedMissingWevu = true;
|
|
31783
31799
|
wevuInstallState = "missing";
|
|
31784
|
-
|
|
31800
|
+
default2.warn("[vue] \u68C0\u6D4B\u5230\u9879\u76EE\u4E2D\u6709 .vue \u6587\u4EF6\uFF0C\u4F46\u672A\u5B89\u88C5 wevu\uFF0C\u8BF7\u5B89\u88C5 wevu \u540E\u91CD\u8BD5\u3002");
|
|
31785
31801
|
}
|
|
31786
31802
|
}
|
|
31787
31803
|
function createVueResolverPlugin(ctx) {
|
|
@@ -31932,7 +31948,7 @@ function createWevuAutoPageFeaturesPlugin(ctx) {
|
|
|
31932
31948
|
pluginPages
|
|
31933
31949
|
};
|
|
31934
31950
|
},
|
|
31935
|
-
warn: (message) =>
|
|
31951
|
+
warn: (message) => default2.warn(message)
|
|
31936
31952
|
}));
|
|
31937
31953
|
if (ctx.runtimeState.scan.isDirty) {
|
|
31938
31954
|
pageMatcher.markDirty();
|
|
@@ -34833,7 +34849,7 @@ function createCompileVueFileOptions(ctx, pluginCtx, vuePath, isPage, isApp, con
|
|
|
34833
34849
|
} else if (classStyleRuntimeConfig === "wxs" && !supportsWxs) {
|
|
34834
34850
|
classStyleRuntime = "js";
|
|
34835
34851
|
if (!state.classStyleRuntimeWarned.value) {
|
|
34836
|
-
|
|
34852
|
+
default2.warn('\u5DF2\u914D\u7F6E vue.template.classStyleRuntime = "wxs"\uFF0C\u4F46\u5F53\u524D\u5E73\u53F0\u4E0D\u652F\u6301 WXS \u6216\u5DF2\u7981\u7528 weapp.wxs\uFF0C\u5C06\u56DE\u9000\u5230 JS \u8FD0\u884C\u65F6\u3002');
|
|
34837
34853
|
state.classStyleRuntimeWarned.value = true;
|
|
34838
34854
|
}
|
|
34839
34855
|
}
|
|
@@ -34844,15 +34860,15 @@ function createCompileVueFileOptions(ctx, pluginCtx, vuePath, isPage, isApp, con
|
|
|
34844
34860
|
return {
|
|
34845
34861
|
isPage,
|
|
34846
34862
|
isApp,
|
|
34847
|
-
warn: (message) =>
|
|
34863
|
+
warn: (message) => default2.warn(message),
|
|
34848
34864
|
autoUsingComponents: {
|
|
34849
34865
|
enabled: true,
|
|
34850
|
-
warn: (message) =>
|
|
34866
|
+
warn: (message) => default2.warn(message),
|
|
34851
34867
|
resolveUsingComponentPath: createUsingComponentPathResolver(pluginCtx, configService, state.reExportResolutionCache)
|
|
34852
34868
|
},
|
|
34853
34869
|
autoImportTags: {
|
|
34854
34870
|
enabled: true,
|
|
34855
|
-
warn: (message) =>
|
|
34871
|
+
warn: (message) => default2.warn(message),
|
|
34856
34872
|
resolveUsingComponent: async (tag) => {
|
|
34857
34873
|
const match2 = ctx.autoImportService?.resolve(tag, removeExtensionDeep12(vuePath));
|
|
34858
34874
|
return match2?.value;
|
|
@@ -35601,7 +35617,7 @@ async function emitVueBundleAssets(bundle, state) {
|
|
|
35601
35617
|
});
|
|
35602
35618
|
} catch (error) {
|
|
35603
35619
|
const message = error instanceof Error ? error.message : String(error);
|
|
35604
|
-
|
|
35620
|
+
default2.error(`[Vue \u7F16\u8BD1] \u7F16\u8BD1 ${entryFilePath} \u5931\u8D25\uFF1A${message}`);
|
|
35605
35621
|
}
|
|
35606
35622
|
}
|
|
35607
35623
|
}
|
|
@@ -35730,7 +35746,7 @@ function createVueTransformPlugin(ctx) {
|
|
|
35730
35746
|
pluginPages
|
|
35731
35747
|
};
|
|
35732
35748
|
},
|
|
35733
|
-
warn: (message) =>
|
|
35749
|
+
warn: (message) => default2.warn(message)
|
|
35734
35750
|
}));
|
|
35735
35751
|
if (ctx.runtimeState.scan.isDirty) {
|
|
35736
35752
|
currentPageMatcher.markDirty();
|
|
@@ -35798,7 +35814,7 @@ function createVueTransformPlugin(ctx) {
|
|
|
35798
35814
|
};
|
|
35799
35815
|
} catch (error) {
|
|
35800
35816
|
const message = error instanceof Error ? error.message : String(error);
|
|
35801
|
-
|
|
35817
|
+
default2.error(`[Vue \u7F16\u8BD1] \u7F16\u8BD1 ${filename} \u5931\u8D25\uFF1A${message}`);
|
|
35802
35818
|
throw error;
|
|
35803
35819
|
}
|
|
35804
35820
|
},
|
|
@@ -35912,14 +35928,14 @@ async function resolveWorkerEntry(ctx, entry) {
|
|
|
35912
35928
|
if (isJsOrTs(entry)) {
|
|
35913
35929
|
const exists = await fs33.pathExists(absoluteEntry);
|
|
35914
35930
|
if (!exists) {
|
|
35915
|
-
|
|
35931
|
+
default2.warn(`\u5F15\u7528 worker: \`${configService.relativeCwd(relativeEntryPath)}\` \u4E0D\u5B58\u5728!`);
|
|
35916
35932
|
return { key };
|
|
35917
35933
|
}
|
|
35918
35934
|
return { key, value: absoluteEntry };
|
|
35919
35935
|
}
|
|
35920
35936
|
const { path: discovered } = await findJsEntry(absoluteEntry);
|
|
35921
35937
|
if (!discovered) {
|
|
35922
|
-
|
|
35938
|
+
default2.warn(`\u5F15\u7528 worker: \`${configService.relativeCwd(relativeEntryPath)}\` \u4E0D\u5B58\u5728!`);
|
|
35923
35939
|
return { key };
|
|
35924
35940
|
}
|
|
35925
35941
|
return { key, value: discovered };
|
|
@@ -35939,7 +35955,7 @@ function createWorkerBuildPlugin(ctx) {
|
|
|
35939
35955
|
options.input = normalized;
|
|
35940
35956
|
},
|
|
35941
35957
|
watchChange(id, change) {
|
|
35942
|
-
|
|
35958
|
+
default2.success(`[workers:${change.event}] ${configService.relativeCwd(id)}`);
|
|
35943
35959
|
},
|
|
35944
35960
|
outputOptions(options) {
|
|
35945
35961
|
options.chunkFileNames = (chunkInfo) => {
|
|
@@ -36806,7 +36822,7 @@ function createJsonService(ctx) {
|
|
|
36806
36822
|
};
|
|
36807
36823
|
const customRequire = async (id, meta) => {
|
|
36808
36824
|
if (process10.env.__WEAPP_VITE_DEBUG_AUTO_ROUTES__) {
|
|
36809
|
-
|
|
36825
|
+
default2.debug("[auto-routes] bundleRequire import", id, meta.format);
|
|
36810
36826
|
}
|
|
36811
36827
|
if (id === "weapp-vite/auto-routes" || id === "weapp-vite/auto-routes.mjs" || id === "weapp-vite/auto-routes.cjs") {
|
|
36812
36828
|
return routesModule;
|
|
@@ -36844,7 +36860,7 @@ function createJsonService(ctx) {
|
|
|
36844
36860
|
cache2.set(filepath, resultJson);
|
|
36845
36861
|
return resultJson;
|
|
36846
36862
|
} catch (error) {
|
|
36847
|
-
|
|
36863
|
+
default2.error(`\u6B8B\u7834\u7684 JSON \u6587\u4EF6\uFF1A${filepath}`);
|
|
36848
36864
|
debug?.(error);
|
|
36849
36865
|
}
|
|
36850
36866
|
}
|
|
@@ -37236,7 +37252,8 @@ async function copyEsModuleDirectoryForAlipay(sourceRoot, targetRoot) {
|
|
|
37236
37252
|
return true;
|
|
37237
37253
|
}
|
|
37238
37254
|
function createPackageBuilder(ctx, oxcVitePlugin) {
|
|
37239
|
-
const npmLogger = typeof
|
|
37255
|
+
const npmLogger = typeof default2.withTag === "function" ? default2.withTag("npm") : default2;
|
|
37256
|
+
const packageBuildInFlight = /* @__PURE__ */ new Map();
|
|
37240
37257
|
function isMiniprogramPackage(pkg) {
|
|
37241
37258
|
return Reflect.has(pkg, "miniprogram") && typeof pkg.miniprogram === "string";
|
|
37242
37259
|
}
|
|
@@ -37317,7 +37334,7 @@ function createPackageBuilder(ctx, oxcVitePlugin) {
|
|
|
37317
37334
|
to
|
|
37318
37335
|
);
|
|
37319
37336
|
}
|
|
37320
|
-
async function
|
|
37337
|
+
async function runBuildPackage({ dep, outDir, options, isDependenciesCacheOutdate }) {
|
|
37321
37338
|
const packageInfo = await getPackageInfo(dep);
|
|
37322
37339
|
if (!packageInfo || !ctx.configService) {
|
|
37323
37340
|
return;
|
|
@@ -37402,6 +37419,25 @@ function createPackageBuilder(ctx, oxcVitePlugin) {
|
|
|
37402
37419
|
}
|
|
37403
37420
|
npmLogger.success(`[npm] \`${dep}\` \u4F9D\u8D56\u5904\u7406\u5B8C\u6210!`);
|
|
37404
37421
|
}
|
|
37422
|
+
async function buildPackage({ dep, outDir, options, isDependenciesCacheOutdate }) {
|
|
37423
|
+
const taskKey = `${path72.resolve(outDir)}::${dep}`;
|
|
37424
|
+
const pending = packageBuildInFlight.get(taskKey);
|
|
37425
|
+
if (pending) {
|
|
37426
|
+
return pending;
|
|
37427
|
+
}
|
|
37428
|
+
const task = runBuildPackage({
|
|
37429
|
+
dep,
|
|
37430
|
+
outDir,
|
|
37431
|
+
options,
|
|
37432
|
+
isDependenciesCacheOutdate
|
|
37433
|
+
}).finally(() => {
|
|
37434
|
+
if (packageBuildInFlight.get(taskKey) === task) {
|
|
37435
|
+
packageBuildInFlight.delete(taskKey);
|
|
37436
|
+
}
|
|
37437
|
+
});
|
|
37438
|
+
packageBuildInFlight.set(taskKey, task);
|
|
37439
|
+
return task;
|
|
37440
|
+
}
|
|
37405
37441
|
return {
|
|
37406
37442
|
isMiniprogramPackage,
|
|
37407
37443
|
shouldSkipBuild,
|
|
@@ -37585,7 +37621,12 @@ function createNpmService(ctx) {
|
|
|
37585
37621
|
};
|
|
37586
37622
|
})
|
|
37587
37623
|
];
|
|
37588
|
-
|
|
37624
|
+
const uniqueTargetDirs = Array.from(
|
|
37625
|
+
new Map(
|
|
37626
|
+
targetDirs.map((item) => [item.npmDistDir, item])
|
|
37627
|
+
).values()
|
|
37628
|
+
);
|
|
37629
|
+
await Promise.all(uniqueTargetDirs.map(async (x2) => {
|
|
37589
37630
|
if (x2.root) {
|
|
37590
37631
|
const isDependenciesCacheOutdate2 = await cache2.checkDependenciesCacheOutdate(x2.root);
|
|
37591
37632
|
if (isDependenciesCacheOutdate2 || !await fs38.pathExists(x2.npmDistDir)) {
|
|
@@ -38751,7 +38792,7 @@ function coerceScope(scope) {
|
|
|
38751
38792
|
return value;
|
|
38752
38793
|
}
|
|
38753
38794
|
if (value && value !== "all") {
|
|
38754
|
-
|
|
38795
|
+
default2.warn(`[\u5206\u5305] \u672A\u8BC6\u522B\u7684\u6837\u5F0F\u4F5C\u7528\u57DF \`${value}\`\uFF0C\u5DF2\u6309 \`all\` \u5904\u7406\u3002`);
|
|
38755
38796
|
}
|
|
38756
38797
|
return "all";
|
|
38757
38798
|
}
|
|
@@ -38856,7 +38897,7 @@ function addStyleEntry(descriptor, absolutePath, posixOutput, root, normalizedRo
|
|
|
38856
38897
|
include.sort();
|
|
38857
38898
|
exclude.sort();
|
|
38858
38899
|
if (!include.length) {
|
|
38859
|
-
|
|
38900
|
+
default2.warn(`[\u5206\u5305] \u5206\u5305 ${root} \u6837\u5F0F\u5165\u53E3 \`${descriptor.source}\` \u7F3A\u5C11\u6709\u6548\u4F5C\u7528\u8303\u56F4\uFF0C\u5DF2\u6309 \`**/*\` \u5904\u7406\u3002`);
|
|
38860
38901
|
include.push("**/*");
|
|
38861
38902
|
}
|
|
38862
38903
|
const key = JSON.stringify({
|
|
@@ -38987,27 +39028,27 @@ function normalizeSubPackageStyleEntries(styles, subPackage, configService) {
|
|
|
38987
39028
|
for (const entry of list) {
|
|
38988
39029
|
const descriptor = coerceStyleConfig(entry);
|
|
38989
39030
|
if (!descriptor) {
|
|
38990
|
-
|
|
39031
|
+
default2.warn(`[\u5206\u5305] \u5206\u5305 ${root} \u6837\u5F0F\u5165\u53E3\u914D\u7F6E\u65E0\u6548\uFF0C\u5DF2\u5FFD\u7565\u3002`);
|
|
38991
39032
|
continue;
|
|
38992
39033
|
}
|
|
38993
39034
|
const absolutePath = resolveStyleEntryAbsolutePath(descriptor.source, root, service);
|
|
38994
39035
|
if (!absolutePath) {
|
|
38995
|
-
|
|
39036
|
+
default2.warn(`[\u5206\u5305] \u5206\u5305 ${root} \u6837\u5F0F\u5165\u53E3 \`${descriptor.source}\` \u89E3\u6790\u5931\u8D25\uFF0C\u5DF2\u5FFD\u7565\u3002`);
|
|
38996
39037
|
continue;
|
|
38997
39038
|
}
|
|
38998
39039
|
if (!fs41.existsSync(absolutePath)) {
|
|
38999
|
-
|
|
39040
|
+
default2.warn(`[\u5206\u5305] \u5206\u5305 ${root} \u6837\u5F0F\u5165\u53E3 \`${descriptor.source}\` \u5BF9\u5E94\u6587\u4EF6\u4E0D\u5B58\u5728\uFF0C\u5DF2\u5FFD\u7565\u3002`);
|
|
39000
39041
|
continue;
|
|
39001
39042
|
}
|
|
39002
39043
|
const ext2 = path78.extname(absolutePath).toLowerCase();
|
|
39003
39044
|
if (!SUPPORTED_SHARED_STYLE_EXTS.has(ext2)) {
|
|
39004
|
-
|
|
39045
|
+
default2.warn(`[\u5206\u5305] \u5206\u5305 ${root} \u6837\u5F0F\u5165\u53E3 \`${descriptor.source}\` \u5F53\u524D\u4EC5\u652F\u6301\u4EE5\u4E0B\u683C\u5F0F\uFF1A${SUPPORTED_SHARED_STYLE_EXTENSIONS.join(", ")}\uFF0C\u5DF2\u5FFD\u7565\u3002`);
|
|
39005
39046
|
continue;
|
|
39006
39047
|
}
|
|
39007
39048
|
const outputAbsolutePath = changeFileExtension(absolutePath, service.outputExtensions.wxss);
|
|
39008
39049
|
const outputRelativePath = service.relativeOutputPath(outputAbsolutePath);
|
|
39009
39050
|
if (!outputRelativePath) {
|
|
39010
|
-
|
|
39051
|
+
default2.warn(`[\u5206\u5305] \u5206\u5305 ${root} \u6837\u5F0F\u5165\u53E3 \`${descriptor.source}\` \u4E0D\u5728\u9879\u76EE\u6E90\u7801\u76EE\u5F55\u5185\uFF0C\u5DF2\u5FFD\u7565\u3002`);
|
|
39011
39052
|
continue;
|
|
39012
39053
|
}
|
|
39013
39054
|
const posixOutput = toPosixPath(outputRelativePath);
|
|
@@ -39483,7 +39524,7 @@ function createWxmlService(ctx) {
|
|
|
39483
39524
|
stat5 = await fs42.stat(filepath);
|
|
39484
39525
|
} catch (error) {
|
|
39485
39526
|
if (error && error.code === "ENOENT") {
|
|
39486
|
-
|
|
39527
|
+
default2.warn(`\u5F15\u7528\u6A21\u677F \`${configService.relativeCwd(filepath)}\` \u4E0D\u5B58\u5728!`);
|
|
39487
39528
|
return;
|
|
39488
39529
|
}
|
|
39489
39530
|
throw error;
|
|
@@ -39597,8 +39638,8 @@ function resetCompilerContext(key) {
|
|
|
39597
39638
|
}
|
|
39598
39639
|
|
|
39599
39640
|
export {
|
|
39641
|
+
default2 as default,
|
|
39600
39642
|
colors,
|
|
39601
|
-
logger_default,
|
|
39602
39643
|
isPathInside,
|
|
39603
39644
|
createCjsConfigLoadError,
|
|
39604
39645
|
getProjectConfigFileName,
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCompilerContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VUALEZY3.mjs";
|
|
4
4
|
import {
|
|
5
5
|
DEFAULT_MP_PLATFORM,
|
|
6
6
|
SHARED_CHUNK_VIRTUAL_PREFIX,
|
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
colors,
|
|
9
9
|
createCjsConfigLoadError,
|
|
10
10
|
createSharedBuildConfig,
|
|
11
|
+
default as default2,
|
|
11
12
|
getProjectConfigFileName,
|
|
12
13
|
isPathInside,
|
|
13
|
-
logger_default,
|
|
14
14
|
normalizeMiniPlatform,
|
|
15
15
|
resolveMiniPlatform,
|
|
16
16
|
resolveWeappConfigFile
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-5BXQZS45.mjs";
|
|
18
18
|
import {
|
|
19
19
|
VERSION
|
|
20
20
|
} from "./chunk-YFWVPDVD.mjs";
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
|
|
25
25
|
// src/cli.ts
|
|
26
26
|
init_esm_shims();
|
|
27
|
+
import process9 from "process";
|
|
27
28
|
|
|
28
29
|
// ../../node_modules/.pnpm/cac@6.7.14/node_modules/cac/dist/index.mjs
|
|
29
30
|
init_esm_shims();
|
|
@@ -611,9 +612,6 @@ var CAC = class extends EventEmitter {
|
|
|
611
612
|
};
|
|
612
613
|
var cac = (name = "") => new CAC(name);
|
|
613
614
|
|
|
614
|
-
// src/cli.ts
|
|
615
|
-
import process9 from "process";
|
|
616
|
-
|
|
617
615
|
// src/cli/commands/analyze.ts
|
|
618
616
|
init_esm_shims();
|
|
619
617
|
import process3 from "process";
|
|
@@ -1097,7 +1095,7 @@ async function waitForServerExit(server) {
|
|
|
1097
1095
|
try {
|
|
1098
1096
|
await server.close();
|
|
1099
1097
|
} catch (error) {
|
|
1100
|
-
|
|
1098
|
+
default2.error(error);
|
|
1101
1099
|
}
|
|
1102
1100
|
};
|
|
1103
1101
|
const signals = ["SIGINT", "SIGTERM"];
|
|
@@ -1175,16 +1173,16 @@ async function startAnalyzeDashboard(result, options) {
|
|
|
1175
1173
|
urls
|
|
1176
1174
|
};
|
|
1177
1175
|
if (options?.watch) {
|
|
1178
|
-
|
|
1176
|
+
default2.info("\u5206\u6790\u4EEA\u8868\u76D8\u5DF2\u542F\u52A8\uFF08\u5B9E\u65F6\u6A21\u5F0F\uFF09\uFF0C\u6309 Ctrl+C \u9000\u51FA\u3002");
|
|
1179
1177
|
for (const url of handle.urls) {
|
|
1180
|
-
|
|
1178
|
+
default2.info(`\u5206\u5305\u5206\u6790\u4EEA\u8868\u76D8\uFF1A${url}`);
|
|
1181
1179
|
}
|
|
1182
1180
|
void waitPromise;
|
|
1183
1181
|
return handle;
|
|
1184
1182
|
}
|
|
1185
|
-
|
|
1183
|
+
default2.info("\u5206\u6790\u4EEA\u8868\u76D8\u5DF2\u542F\u52A8\uFF08\u9759\u6001\u6A21\u5F0F\uFF09\uFF0C\u6309 Ctrl+C \u9000\u51FA\u3002");
|
|
1186
1184
|
for (const url of handle.urls) {
|
|
1187
|
-
|
|
1185
|
+
default2.info(`\u5206\u5305\u5206\u6790\u4EEA\u8868\u76D8\uFF1A${url}`);
|
|
1188
1186
|
}
|
|
1189
1187
|
await waitPromise;
|
|
1190
1188
|
}
|
|
@@ -1247,13 +1245,13 @@ function logRuntimeTarget(targets, options = {}) {
|
|
|
1247
1245
|
if (targets.label === "config") {
|
|
1248
1246
|
const resolvedPlatform = targets.mpPlatform ?? options.resolvedConfigPlatform;
|
|
1249
1247
|
if (resolvedPlatform) {
|
|
1250
|
-
|
|
1248
|
+
default2.info(`\u76EE\u6807\u5E73\u53F0\uFF1A${colors.green(resolvedPlatform)}`);
|
|
1251
1249
|
return;
|
|
1252
1250
|
}
|
|
1253
|
-
|
|
1251
|
+
default2.info(`\u76EE\u6807\u5E73\u53F0\uFF1A\u4F7F\u7528\u914D\u7F6E\u6587\u4EF6\u4E2D\u7684 ${colors.bold(colors.green("weapp.platform"))}`);
|
|
1254
1252
|
return;
|
|
1255
1253
|
}
|
|
1256
|
-
|
|
1254
|
+
default2.info(`\u76EE\u6807\u5E73\u53F0\uFF1A${colors.green(targets.label)}`);
|
|
1257
1255
|
}
|
|
1258
1256
|
function resolveRuntimeTargets(options) {
|
|
1259
1257
|
const rawPlatform = typeof options.platform === "string" ? options.platform : typeof options.p === "string" ? options.p : void 0;
|
|
@@ -1295,7 +1293,7 @@ function resolveRuntimeTargets(options) {
|
|
|
1295
1293
|
rawPlatform
|
|
1296
1294
|
};
|
|
1297
1295
|
}
|
|
1298
|
-
|
|
1296
|
+
default2.warn(`\u672A\u8BC6\u522B\u7684\u5E73\u53F0 "${colors.yellow(rawPlatform)}"\uFF0C\u5DF2\u56DE\u9000\u5230 ${colors.green(DEFAULT_MP_PLATFORM)}`);
|
|
1299
1297
|
return {
|
|
1300
1298
|
runMini: true,
|
|
1301
1299
|
runWeb: false,
|
|
@@ -1316,6 +1314,52 @@ function createInlineConfig(mpPlatform) {
|
|
|
1316
1314
|
}
|
|
1317
1315
|
|
|
1318
1316
|
// src/cli/commands/analyze.ts
|
|
1317
|
+
function normalizeDisplayPath(value) {
|
|
1318
|
+
return value || ".";
|
|
1319
|
+
}
|
|
1320
|
+
function getDefaultWebAnalyzeScopes() {
|
|
1321
|
+
return {
|
|
1322
|
+
supported: [
|
|
1323
|
+
"weapp.web \u914D\u7F6E\u89E3\u6790\uFF08enable/root/srcDir/outDir\uFF09",
|
|
1324
|
+
"runtime.executionMode \u9759\u6001\u89E3\u6790\uFF08compat/safe/strict\uFF09",
|
|
1325
|
+
"JSON \u62A5\u544A\u8F93\u51FA\uFF08--json/--output\uFF09"
|
|
1326
|
+
],
|
|
1327
|
+
unsupported: [
|
|
1328
|
+
"\u5206\u5305\u4EA7\u7269\u4F53\u79EF\u5206\u6790\uFF08\u4EC5\u5C0F\u7A0B\u5E8F\uFF09",
|
|
1329
|
+
"\u6E90\u7801\u6A21\u5757\u5305\u4F53\u6620\u5C04\uFF08\u4EC5\u5C0F\u7A0B\u5E8F\uFF09",
|
|
1330
|
+
"\u5206\u6790\u4EEA\u8868\u76D8\uFF08dashboard\uFF09"
|
|
1331
|
+
]
|
|
1332
|
+
};
|
|
1333
|
+
}
|
|
1334
|
+
function createWebAnalyzeResult(configService, options) {
|
|
1335
|
+
const webConfig = configService.weappWebConfig;
|
|
1336
|
+
const executionMode = webConfig?.pluginOptions.runtime?.executionMode ?? "compat";
|
|
1337
|
+
const scope = getDefaultWebAnalyzeScopes();
|
|
1338
|
+
const limitations = [
|
|
1339
|
+
"\u5F53\u524D\u4EC5\u63D0\u4F9B\u9759\u6001\u914D\u7F6E\u5206\u6790\uFF0C\u4E0D\u6267\u884C Web \u4EA7\u7269\u626B\u63CF\u3002"
|
|
1340
|
+
];
|
|
1341
|
+
if (!webConfig?.enabled) {
|
|
1342
|
+
limitations.push("\u672A\u68C0\u6D4B\u5230\u542F\u7528\u7684 weapp.web \u914D\u7F6E\u3002");
|
|
1343
|
+
}
|
|
1344
|
+
return {
|
|
1345
|
+
runtime: "web",
|
|
1346
|
+
platform: options.platform,
|
|
1347
|
+
mode: configService.mode,
|
|
1348
|
+
generatedAt: (options.now ?? /* @__PURE__ */ new Date()).toISOString(),
|
|
1349
|
+
experimental: true,
|
|
1350
|
+
configFile: configService.configFilePath ? normalizeDisplayPath(configService.relativeCwd(configService.configFilePath)) : void 0,
|
|
1351
|
+
web: {
|
|
1352
|
+
enabled: Boolean(webConfig?.enabled),
|
|
1353
|
+
root: webConfig?.root ? normalizeDisplayPath(configService.relativeCwd(webConfig.root)) : void 0,
|
|
1354
|
+
srcDir: webConfig?.srcDir,
|
|
1355
|
+
outDir: webConfig?.outDir ? normalizeDisplayPath(configService.relativeCwd(webConfig.outDir)) : void 0,
|
|
1356
|
+
executionMode
|
|
1357
|
+
},
|
|
1358
|
+
supportedScopes: scope.supported,
|
|
1359
|
+
unsupportedScopes: scope.unsupported,
|
|
1360
|
+
limitations
|
|
1361
|
+
};
|
|
1362
|
+
}
|
|
1319
1363
|
function printAnalysisSummary(result) {
|
|
1320
1364
|
const packageLabelMap = /* @__PURE__ */ new Map();
|
|
1321
1365
|
const packageModuleSet = /* @__PURE__ */ new Map();
|
|
@@ -1329,15 +1373,15 @@ function printAnalysisSummary(result) {
|
|
|
1329
1373
|
packageModuleSet.set(pkgRef.packageId, set);
|
|
1330
1374
|
}
|
|
1331
1375
|
}
|
|
1332
|
-
|
|
1376
|
+
default2.success("\u5206\u5305\u5206\u6790\u5B8C\u6210");
|
|
1333
1377
|
for (const pkg of result.packages) {
|
|
1334
1378
|
const chunkCount = pkg.files.filter((file) => file.type === "chunk").length;
|
|
1335
1379
|
const assetCount = pkg.files.length - chunkCount;
|
|
1336
1380
|
const moduleCount = packageModuleSet.get(pkg.id)?.size ?? 0;
|
|
1337
|
-
|
|
1381
|
+
default2.info(`- ${pkg.label}\uFF1A${chunkCount} \u4E2A\u6A21\u5757\u4EA7\u7269\uFF0C${assetCount} \u4E2A\u8D44\u6E90\uFF0C\u8986\u76D6 ${moduleCount} \u4E2A\u6E90\u7801\u6A21\u5757`);
|
|
1338
1382
|
}
|
|
1339
1383
|
if (result.subPackages.length > 0) {
|
|
1340
|
-
|
|
1384
|
+
default2.info("\u5206\u5305\u914D\u7F6E\uFF1A");
|
|
1341
1385
|
for (const descriptor of result.subPackages) {
|
|
1342
1386
|
const segments = [descriptor.root];
|
|
1343
1387
|
if (descriptor.name) {
|
|
@@ -1346,15 +1390,15 @@ function printAnalysisSummary(result) {
|
|
|
1346
1390
|
if (descriptor.independent) {
|
|
1347
1391
|
segments.push("\u72EC\u7ACB\u6784\u5EFA");
|
|
1348
1392
|
}
|
|
1349
|
-
|
|
1393
|
+
default2.info(`- ${segments.join("\uFF0C")}`);
|
|
1350
1394
|
}
|
|
1351
1395
|
}
|
|
1352
1396
|
const duplicates = result.modules.filter((module) => module.packages.length > 1);
|
|
1353
1397
|
if (duplicates.length === 0) {
|
|
1354
|
-
|
|
1398
|
+
default2.info("\u672A\u68C0\u6D4B\u5230\u8DE8\u5305\u590D\u7528\u7684\u6E90\u7801\u6A21\u5757\u3002");
|
|
1355
1399
|
return;
|
|
1356
1400
|
}
|
|
1357
|
-
|
|
1401
|
+
default2.info(`\u8DE8\u5305\u590D\u7528/\u590D\u5236\u6E90\u7801\u5171 ${duplicates.length} \u9879\uFF1A`);
|
|
1358
1402
|
const limit = 10;
|
|
1359
1403
|
const entries = duplicates.slice(0, limit);
|
|
1360
1404
|
for (const module of entries) {
|
|
@@ -1362,25 +1406,46 @@ function printAnalysisSummary(result) {
|
|
|
1362
1406
|
const label = packageLabelMap.get(pkgRef.packageId) ?? pkgRef.packageId;
|
|
1363
1407
|
return `${label} \u2192 ${pkgRef.files.join(", ")}`;
|
|
1364
1408
|
}).join("\uFF1B");
|
|
1365
|
-
|
|
1409
|
+
default2.info(`- ${module.source} (${module.sourceType})\uFF1A${placements}`);
|
|
1366
1410
|
}
|
|
1367
1411
|
if (duplicates.length > limit) {
|
|
1368
|
-
|
|
1412
|
+
default2.info(`- \u2026\u5176\u4F59 ${duplicates.length - limit} \u9879\u8BF7\u4F7F\u7528 ${colors.bold(colors.green("weapp-vite analyze --json"))} \u67E5\u770B`);
|
|
1369
1413
|
}
|
|
1370
1414
|
}
|
|
1415
|
+
function printWebAnalysisSummary(result) {
|
|
1416
|
+
default2.success("Web \u9759\u6001\u5206\u6790\u5B8C\u6210");
|
|
1417
|
+
default2.info(`- \u914D\u7F6E\u72B6\u6001\uFF1A${result.web.enabled ? "\u5DF2\u542F\u7528 weapp.web" : "\u672A\u542F\u7528 weapp.web"}`);
|
|
1418
|
+
if (result.web.enabled) {
|
|
1419
|
+
default2.info(`- root\uFF1A${result.web.root ?? "."}`);
|
|
1420
|
+
default2.info(`- srcDir\uFF1A${result.web.srcDir ?? "."}`);
|
|
1421
|
+
default2.info(`- outDir\uFF1A${result.web.outDir ?? "dist/web"}`);
|
|
1422
|
+
}
|
|
1423
|
+
default2.info(`- executionMode\uFF1A${result.web.executionMode}`);
|
|
1424
|
+
default2.info(`- \u652F\u6301\u8303\u56F4\uFF1A${result.supportedScopes.join("\uFF1B")}`);
|
|
1425
|
+
default2.warn(`- \u672A\u652F\u6301\u8303\u56F4\uFF1A${result.unsupportedScopes.join("\uFF1B")}`);
|
|
1426
|
+
for (const limitation of result.limitations) {
|
|
1427
|
+
default2.warn(`- \u9650\u5236\uFF1A${limitation}`);
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
async function writeAnalyzeResult(result, outputOption, configService) {
|
|
1431
|
+
if (!outputOption) {
|
|
1432
|
+
return void 0;
|
|
1433
|
+
}
|
|
1434
|
+
const baseDir = configService.cwd;
|
|
1435
|
+
const resolvedOutputPath = path3.isAbsolute(outputOption) ? outputOption : path3.resolve(baseDir, outputOption);
|
|
1436
|
+
await fs3.ensureDir(path3.dirname(resolvedOutputPath));
|
|
1437
|
+
await fs3.writeFile(resolvedOutputPath, `${JSON.stringify(result, null, 2)}
|
|
1438
|
+
`, "utf8");
|
|
1439
|
+
const relativeOutput = configService.relativeCwd(resolvedOutputPath);
|
|
1440
|
+
default2.success(`\u5206\u6790\u7ED3\u679C\u5DF2\u5199\u5165 ${colors.green(relativeOutput)}`);
|
|
1441
|
+
return resolvedOutputPath;
|
|
1442
|
+
}
|
|
1371
1443
|
function registerAnalyzeCommand(cli2) {
|
|
1372
1444
|
cli2.command("analyze [root]", "analyze \u4E24\u7AEF\u5305\u4F53\u4E0E\u6E90\u7801\u6620\u5C04").option("--json", `[boolean] \u8F93\u51FA JSON \u7ED3\u679C`).option("--output <file>", `[string] \u5C06\u5206\u6790\u7ED3\u679C\u5199\u5165\u6307\u5B9A\u6587\u4EF6\uFF08JSON\uFF09`).option("-p, --platform <platform>", `[string] target platform (weapp | h5)`).option("--project-config <path>", `[string] project config path (miniprogram only)`).action(async (root, options) => {
|
|
1373
1445
|
filterDuplicateOptions(options);
|
|
1374
1446
|
const configFile = resolveConfigFile(options);
|
|
1375
1447
|
const outputJson = coerceBooleanOption(options.json);
|
|
1376
1448
|
const targets = resolveRuntimeTargets(options);
|
|
1377
|
-
if (!targets.runMini) {
|
|
1378
|
-
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");
|
|
1379
|
-
return;
|
|
1380
|
-
}
|
|
1381
|
-
if (targets.runWeb) {
|
|
1382
|
-
logger_default.warn("\u5206\u6790\u547D\u4EE4\u6682\u4E0D\u652F\u6301 Web \u5E73\u53F0\uFF0C\u5C06\u5FFD\u7565\u76F8\u5173\u914D\u7F6E\u3002");
|
|
1383
|
-
}
|
|
1384
1449
|
const inlineConfig = createInlineConfig(targets.mpPlatform);
|
|
1385
1450
|
try {
|
|
1386
1451
|
const ctx = await createCompilerContext({
|
|
@@ -1395,20 +1460,28 @@ function registerAnalyzeCommand(cli2) {
|
|
|
1395
1460
|
silent: outputJson,
|
|
1396
1461
|
resolvedConfigPlatform: ctx.configService.platform
|
|
1397
1462
|
});
|
|
1398
|
-
const result = await analyzeSubpackages(ctx);
|
|
1399
1463
|
const outputOption = typeof options.output === "string" ? options.output.trim() : "";
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
const
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1464
|
+
if (targets.runWeb) {
|
|
1465
|
+
const webResult = createWebAnalyzeResult(ctx.configService, {
|
|
1466
|
+
platform: targets.label === "web" ? "web" : "h5"
|
|
1467
|
+
});
|
|
1468
|
+
const writtenPath2 = await writeAnalyzeResult(webResult, outputOption, ctx.configService);
|
|
1469
|
+
if (outputJson) {
|
|
1470
|
+
if (!writtenPath2) {
|
|
1471
|
+
process3.stdout.write(`${JSON.stringify(webResult, null, 2)}
|
|
1472
|
+
`);
|
|
1473
|
+
}
|
|
1474
|
+
} else {
|
|
1475
|
+
printWebAnalysisSummary(webResult);
|
|
1476
|
+
}
|
|
1477
|
+
return;
|
|
1478
|
+
}
|
|
1479
|
+
if (!targets.runMini) {
|
|
1480
|
+
default2.warn("\u5F53\u524D\u547D\u4EE4\u4E0D\u652F\u6301\u8BE5\u5E73\u53F0\uFF0C\u8BF7\u901A\u8FC7 --platform weapp \u6216 --platform h5 \u6307\u5B9A\u76EE\u6807\u3002");
|
|
1481
|
+
return;
|
|
1411
1482
|
}
|
|
1483
|
+
const result = await analyzeSubpackages(ctx);
|
|
1484
|
+
const writtenPath = await writeAnalyzeResult(result, outputOption, ctx.configService);
|
|
1412
1485
|
if (outputJson) {
|
|
1413
1486
|
if (!writtenPath) {
|
|
1414
1487
|
process3.stdout.write(`${JSON.stringify(result, null, 2)}
|
|
@@ -1419,7 +1492,7 @@ function registerAnalyzeCommand(cli2) {
|
|
|
1419
1492
|
await startAnalyzeDashboard(result);
|
|
1420
1493
|
}
|
|
1421
1494
|
} catch (error) {
|
|
1422
|
-
|
|
1495
|
+
default2.error(error);
|
|
1423
1496
|
process3.exitCode = 1;
|
|
1424
1497
|
}
|
|
1425
1498
|
});
|
|
@@ -1578,15 +1651,15 @@ function logBuildAppFinish(configService, webServer, options = {}) {
|
|
|
1578
1651
|
const urls = webServer.resolvedUrls;
|
|
1579
1652
|
const candidates = urls ? [...urls.local ?? [], ...urls.network ?? []] : [];
|
|
1580
1653
|
if (candidates.length > 0) {
|
|
1581
|
-
|
|
1654
|
+
default2.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8\uFF0C\u6D4F\u89C8\u5668\u8BBF\u95EE\uFF1A");
|
|
1582
1655
|
for (const url of candidates) {
|
|
1583
|
-
|
|
1656
|
+
default2.info(` \u279C ${colors.cyan(url)}`);
|
|
1584
1657
|
}
|
|
1585
1658
|
} else {
|
|
1586
|
-
|
|
1659
|
+
default2.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
|
|
1587
1660
|
}
|
|
1588
1661
|
} else {
|
|
1589
|
-
|
|
1662
|
+
default2.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
|
|
1590
1663
|
}
|
|
1591
1664
|
logBuildAppFinishOnlyShowOnce = true;
|
|
1592
1665
|
return;
|
|
@@ -1600,20 +1673,20 @@ function logBuildAppFinish(configService, webServer, options = {}) {
|
|
|
1600
1673
|
args: ["run", "open"]
|
|
1601
1674
|
};
|
|
1602
1675
|
const devCommand = `${command} ${args.join(" ")}`;
|
|
1603
|
-
|
|
1604
|
-
|
|
1676
|
+
default2.success("\u5E94\u7528\u6784\u5EFA\u5B8C\u6210\uFF01\u9884\u89C8\u65B9\u5F0F\uFF082 \u79CD\u9009\u5176\u4E00\u5373\u53EF\uFF09\uFF1A");
|
|
1677
|
+
default2.info(`\u6267\u884C ${colors.bold(colors.green(devCommand))} \u53EF\u4EE5\u76F4\u63A5\u5728\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\u91CC\u6253\u5F00\u5F53\u524D\u5E94\u7528`);
|
|
1605
1678
|
const projectConfigFileName = getProjectConfigFileName(configService.platform);
|
|
1606
|
-
|
|
1679
|
+
default2.info(`\u6216\u624B\u52A8\u6253\u5F00\u5BF9\u5E94\u5E73\u53F0\u5F00\u53D1\u8005\u5DE5\u5177\uFF0C\u5BFC\u5165\u6839\u76EE\u5F55\uFF08${colors.green(projectConfigFileName)} \u6587\u4EF6\u6240\u5728\u76EE\u5F55\uFF09\uFF0C\u5373\u53EF\u9884\u89C8\u6548\u679C`);
|
|
1607
1680
|
if (!skipWeb && webServer) {
|
|
1608
1681
|
const urls = webServer.resolvedUrls;
|
|
1609
1682
|
const candidates = urls ? [...urls.local ?? [], ...urls.network ?? []] : [];
|
|
1610
1683
|
if (candidates.length > 0) {
|
|
1611
|
-
|
|
1684
|
+
default2.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8\uFF0C\u6D4F\u89C8\u5668\u8BBF\u95EE\uFF1A");
|
|
1612
1685
|
for (const url of candidates) {
|
|
1613
|
-
|
|
1686
|
+
default2.info(` \u279C ${colors.cyan(url)}`);
|
|
1614
1687
|
}
|
|
1615
1688
|
} else {
|
|
1616
|
-
|
|
1689
|
+
default2.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
|
|
1617
1690
|
}
|
|
1618
1691
|
}
|
|
1619
1692
|
logBuildAppFinishOnlyShowOnce = true;
|
|
@@ -1647,19 +1720,19 @@ async function runWechatIdeOpenWithRetry(argv) {
|
|
|
1647
1720
|
return;
|
|
1648
1721
|
} catch (error) {
|
|
1649
1722
|
if (!isWechatIdeLoginRequiredError(error)) {
|
|
1650
|
-
|
|
1723
|
+
default2.error(error);
|
|
1651
1724
|
return;
|
|
1652
1725
|
}
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1726
|
+
default2.error("\u68C0\u6D4B\u5230\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\u767B\u5F55\u72B6\u6001\u5931\u6548\uFF0C\u8BF7\u5148\u767B\u5F55\u540E\u91CD\u8BD5\u3002");
|
|
1727
|
+
default2.warn(formatWechatIdeLoginRequiredError(error));
|
|
1728
|
+
default2.info(formatRetryHotkeyPrompt());
|
|
1656
1729
|
const shouldRetry = await waitForRetryKeypress();
|
|
1657
1730
|
if (!shouldRetry) {
|
|
1658
|
-
|
|
1731
|
+
default2.warn("\u5DF2\u53D6\u6D88\u91CD\u8BD5\u3002\u5B8C\u6210\u767B\u5F55\u540E\u8BF7\u91CD\u65B0\u6267\u884C\u5F53\u524D\u547D\u4EE4\u3002");
|
|
1659
1732
|
retrying = false;
|
|
1660
1733
|
continue;
|
|
1661
1734
|
}
|
|
1662
|
-
|
|
1735
|
+
default2.info(colors.bold(colors.green("\u6B63\u5728\u91CD\u8BD5\u8FDE\u63A5\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177...")));
|
|
1663
1736
|
}
|
|
1664
1737
|
}
|
|
1665
1738
|
}
|
|
@@ -1713,9 +1786,9 @@ function registerBuildCommand(cli2) {
|
|
|
1713
1786
|
if (targets.runWeb && webConfig?.enabled) {
|
|
1714
1787
|
try {
|
|
1715
1788
|
await webService?.build();
|
|
1716
|
-
|
|
1789
|
+
default2.success(`Web \u6784\u5EFA\u5B8C\u6210\uFF0C\u8F93\u51FA\u76EE\u5F55\uFF1A${colors.green(configService.relativeCwd(webConfig.outDir))}`);
|
|
1717
1790
|
} catch (error) {
|
|
1718
|
-
|
|
1791
|
+
default2.error(error);
|
|
1719
1792
|
throw error;
|
|
1720
1793
|
}
|
|
1721
1794
|
}
|
|
@@ -1859,7 +1932,7 @@ async function generate(options) {
|
|
|
1859
1932
|
for (const { code, fileName: fileName2 } of files) {
|
|
1860
1933
|
if (code !== void 0) {
|
|
1861
1934
|
await fs4.outputFile(path5.resolve(basepath, fileName2), code, "utf8");
|
|
1862
|
-
|
|
1935
|
+
default2.success(`${composePath(outDir, fileName2)} \u521B\u5EFA\u6210\u529F\uFF01`);
|
|
1863
1936
|
}
|
|
1864
1937
|
}
|
|
1865
1938
|
}
|
|
@@ -1959,7 +2032,7 @@ function registerGenerateCommand(cli2) {
|
|
|
1959
2032
|
fileName = "app";
|
|
1960
2033
|
}
|
|
1961
2034
|
if (filepath === void 0) {
|
|
1962
|
-
|
|
2035
|
+
default2.error("weapp-vite generate <outDir> \u547D\u4EE4\u5FC5\u987B\u4F20\u5165\u8DEF\u5F84\u53C2\u6570 outDir");
|
|
1963
2036
|
return;
|
|
1964
2037
|
}
|
|
1965
2038
|
if (options.page) {
|
|
@@ -1987,7 +2060,7 @@ function registerInitCommand(cli2) {
|
|
|
1987
2060
|
command: "weapp-vite"
|
|
1988
2061
|
});
|
|
1989
2062
|
} catch (error) {
|
|
1990
|
-
|
|
2063
|
+
default2.error(error);
|
|
1991
2064
|
}
|
|
1992
2065
|
});
|
|
1993
2066
|
}
|
|
@@ -2000,7 +2073,7 @@ function registerNpmCommand(cli2) {
|
|
|
2000
2073
|
try {
|
|
2001
2074
|
await parse2(["build-npm", "-p"]);
|
|
2002
2075
|
} catch (error) {
|
|
2003
|
-
|
|
2076
|
+
default2.error(error);
|
|
2004
2077
|
}
|
|
2005
2078
|
});
|
|
2006
2079
|
}
|
|
@@ -2105,7 +2178,7 @@ function registerServeCommand(cli2) {
|
|
|
2105
2178
|
try {
|
|
2106
2179
|
webServer = await webService?.startDevServer();
|
|
2107
2180
|
} catch (error) {
|
|
2108
|
-
|
|
2181
|
+
default2.error(error);
|
|
2109
2182
|
throw error;
|
|
2110
2183
|
}
|
|
2111
2184
|
}
|
|
@@ -2181,10 +2254,10 @@ function handleCLIError(error) {
|
|
|
2181
2254
|
const code = findWatchLimitErrorCode(error);
|
|
2182
2255
|
if (code) {
|
|
2183
2256
|
const tip = process8.platform === "darwin" ? "\u53EF\u5148\u6267\u884C `ulimit -n 65536` \u540E\u91CD\u8BD5\u3002" : "\u8BF7\u63D0\u9AD8\u7CFB\u7EDF\u6587\u4EF6\u63CF\u8FF0\u7B26\u4E0A\u9650\u540E\u91CD\u8BD5\u3002";
|
|
2184
|
-
|
|
2257
|
+
default2.error(`[\u76D1\u542C] \u6587\u4EF6\u76D1\u542C\u6570\u91CF\u8FBE\u5230\u4E0A\u9650 (${code})\uFF0C${tip}`);
|
|
2185
2258
|
return;
|
|
2186
2259
|
}
|
|
2187
|
-
|
|
2260
|
+
default2.error(error);
|
|
2188
2261
|
}
|
|
2189
2262
|
|
|
2190
2263
|
// src/cli.ts
|
|
@@ -204,7 +204,7 @@ interface WeappWebConfig {
|
|
|
204
204
|
/**
|
|
205
205
|
* @description 传递给 `weappWebPlugin` 的额外参数(不包含 `srcDir`)
|
|
206
206
|
* @example
|
|
207
|
-
* pluginOptions: { runtime: '
|
|
207
|
+
* pluginOptions: { runtime: { executionMode: 'safe' } }
|
|
208
208
|
*/
|
|
209
209
|
pluginOptions?: Partial<Omit<WeappWebPluginOptions, 'srcDir'>>;
|
|
210
210
|
/**
|
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'vite';
|
|
2
|
-
export { U as UserConfig, a as UserConfigExport, b as UserConfigFn, c as UserConfigFnNoEnv, d as UserConfigFnNoEnvPlain, e as UserConfigFnObject, f as UserConfigFnObjectPlain, g as UserConfigFnPromise, W as WeappViteConfig, h as defineAppJson, i as defineComponentJson, j as defineConfig, k as definePageJson, l as defineSitemapJson, m as defineThemeJson } from './config-
|
|
2
|
+
export { U as UserConfig, a as UserConfigExport, b as UserConfigFn, c as UserConfigFnNoEnv, d as UserConfigFnNoEnvPlain, e as UserConfigFnObject, f as UserConfigFnObjectPlain, g as UserConfigFnPromise, W as WeappViteConfig, h as defineAppJson, i as defineComponentJson, j as defineConfig, k as definePageJson, l as defineSitemapJson, m as defineThemeJson } from './config-CdeM_u7y.js';
|
|
3
3
|
export { App, Component, Page, Sitemap, Theme } from '@weapp-core/schematics';
|
|
4
4
|
import '@weapp-vite/web';
|
|
5
5
|
import 'rolldown';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LoadConfigOptions, C as CompilerContext } from './config-
|
|
2
|
-
export { U as UserConfig, a as UserConfigExport, b as UserConfigFn, c as UserConfigFnNoEnv, d as UserConfigFnNoEnvPlain, e as UserConfigFnObject, f as UserConfigFnObjectPlain, g as UserConfigFnPromise, W as WeappViteConfig, h as defineAppJson, i as defineComponentJson, j as defineConfig, k as definePageJson, l as defineSitemapJson, m as defineThemeJson } from './config-
|
|
1
|
+
import { L as LoadConfigOptions, C as CompilerContext } from './config-CdeM_u7y.js';
|
|
2
|
+
export { U as UserConfig, a as UserConfigExport, b as UserConfigFn, c as UserConfigFnNoEnv, d as UserConfigFnNoEnvPlain, e as UserConfigFnObject, f as UserConfigFnObjectPlain, g as UserConfigFnPromise, W as WeappViteConfig, h as defineAppJson, i as defineComponentJson, j as defineConfig, k as definePageJson, l as defineSitemapJson, m as defineThemeJson } from './config-CdeM_u7y.js';
|
|
3
3
|
export { WevuComponentOptions, defineEmits, defineProps } from './runtime.js';
|
|
4
4
|
export { RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, WatchOptions as RolldownWatchOptions, RolldownWatcher } from 'rolldown';
|
|
5
5
|
export { ConfigEnv, InlineConfig, Plugin, PluginOption, ResolvedConfig, ViteDevServer } from 'vite';
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "./chunk-XPH5IUSV.mjs";
|
|
2
2
|
import {
|
|
3
3
|
createCompilerContext
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VUALEZY3.mjs";
|
|
5
5
|
import {
|
|
6
6
|
defineEmits,
|
|
7
7
|
defineProps
|
|
8
8
|
} from "./chunk-4UCXO3GV.mjs";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-5BXQZS45.mjs";
|
|
10
10
|
import "./chunk-YFWVPDVD.mjs";
|
|
11
11
|
import {
|
|
12
12
|
defineConfig
|
package/dist/json.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { App, Component, Page, Sitemap, Theme } from '@weapp-core/schematics';
|
|
2
|
-
export { h as defineAppJson, i as defineComponentJson, k as definePageJson, l as defineSitemapJson, m as defineThemeJson } from './config-
|
|
2
|
+
export { h as defineAppJson, i as defineComponentJson, k as definePageJson, l as defineSitemapJson, m as defineThemeJson } from './config-CdeM_u7y.js';
|
|
3
3
|
import 'vite';
|
|
4
4
|
import '@weapp-vite/web';
|
|
5
5
|
import 'rolldown';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Alias, n as AliasOptions, o as AlipayNpmMode, p as AppEntry, q as AutoImportComponents, r as AutoImportComponentsOption, B as BaseEntry, s as BuildNpmPackageMeta, t as ChangeEvent, u as ChunksConfig, v as ComponentEntry, w as ComponentsMap, x as CopyGlobs, y as CopyOptions, E as EnhanceOptions, z as EnhanceWxmlOptions, D as Entry, F as EntryJsonFragment, G as GenerateDirsOptions, H as GenerateExtensionsOptions, I as GenerateFileType, J as GenerateFilenamesOptions, K as GenerateOptions, M as GenerateTemplate, N as GenerateTemplateContext, O as GenerateTemplateEntry, P as GenerateTemplateFactory, Q as GenerateTemplateFileSource, R as GenerateTemplateInlineSource, S as GenerateTemplateScope, T as GenerateTemplatesConfig, V as HandleWxmlOptions, X as JsFormat, Y as JsonConfig, Z as JsonMergeContext, _ as JsonMergeFunction, $ as JsonMergeStage, a0 as JsonMergeStrategy, a1 as MpPlatform, a2 as MultiPlatformConfig, a3 as NpmBuildOptions, a4 as PageEntry, a5 as ProjectConfig, a6 as ResolvedAlias, a7 as ScanComponentItem, a8 as ScanWxmlOptions, a9 as SharedChunkDynamicImports, aa as SharedChunkMode, ab as SharedChunkOverride, ac as SharedChunkStrategy, ad as SubPackage, ae as SubPackageMetaValue, af as SubPackageStyleConfigEntry, ag as SubPackageStyleConfigObject, ah as SubPackageStyleEntry, ai as SubPackageStyleScope, aj as UserConfig, ak as WeappLibComponentJson, al as WeappLibConfig, am as WeappLibDtsOptions, an as WeappLibEntryContext, ao as WeappLibFileName, ap as WeappLibInternalDtsOptions, aq as WeappLibVueTscOptions, W as WeappViteConfig, ar as WeappVitePluginApi, as as WeappWebConfig, at as WxmlDep } from './config-
|
|
1
|
+
export { A as Alias, n as AliasOptions, o as AlipayNpmMode, p as AppEntry, q as AutoImportComponents, r as AutoImportComponentsOption, B as BaseEntry, s as BuildNpmPackageMeta, t as ChangeEvent, u as ChunksConfig, v as ComponentEntry, w as ComponentsMap, x as CopyGlobs, y as CopyOptions, E as EnhanceOptions, z as EnhanceWxmlOptions, D as Entry, F as EntryJsonFragment, G as GenerateDirsOptions, H as GenerateExtensionsOptions, I as GenerateFileType, J as GenerateFilenamesOptions, K as GenerateOptions, M as GenerateTemplate, N as GenerateTemplateContext, O as GenerateTemplateEntry, P as GenerateTemplateFactory, Q as GenerateTemplateFileSource, R as GenerateTemplateInlineSource, S as GenerateTemplateScope, T as GenerateTemplatesConfig, V as HandleWxmlOptions, X as JsFormat, Y as JsonConfig, Z as JsonMergeContext, _ as JsonMergeFunction, $ as JsonMergeStage, a0 as JsonMergeStrategy, a1 as MpPlatform, a2 as MultiPlatformConfig, a3 as NpmBuildOptions, a4 as PageEntry, a5 as ProjectConfig, a6 as ResolvedAlias, a7 as ScanComponentItem, a8 as ScanWxmlOptions, a9 as SharedChunkDynamicImports, aa as SharedChunkMode, ab as SharedChunkOverride, ac as SharedChunkStrategy, ad as SubPackage, ae as SubPackageMetaValue, af as SubPackageStyleConfigEntry, ag as SubPackageStyleConfigObject, ah as SubPackageStyleEntry, ai as SubPackageStyleScope, aj as UserConfig, ak as WeappLibComponentJson, al as WeappLibConfig, am as WeappLibDtsOptions, an as WeappLibEntryContext, ao as WeappLibFileName, ap as WeappLibInternalDtsOptions, aq as WeappLibVueTscOptions, W as WeappViteConfig, ar as WeappVitePluginApi, as as WeappWebConfig, at as WxmlDep } from './config-CdeM_u7y.js';
|
|
2
2
|
export { RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, WatchOptions as RolldownWatchOptions, RolldownWatcher } from 'rolldown';
|
|
3
3
|
export { ConfigEnv, InlineConfig, Plugin, PluginOption, ResolvedConfig, ViteDevServer } from 'vite';
|
|
4
4
|
export { ComputedDefinitions, MethodDefinitions, Ref } from 'wevu';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.6.
|
|
4
|
+
"version": "6.6.6",
|
|
5
5
|
"description": "weapp-vite 一个现代化的小程序打包工具",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -112,12 +112,12 @@
|
|
|
112
112
|
"@weapp-core/schematics": "6.0.2",
|
|
113
113
|
"@weapp-core/shared": "3.0.1",
|
|
114
114
|
"@weapp-vite/volar": "2.0.4",
|
|
115
|
-
"@weapp-vite/web": "1.
|
|
115
|
+
"@weapp-vite/web": "1.3.0",
|
|
116
116
|
"@wevu/api": "0.1.1",
|
|
117
117
|
"rolldown-require": "2.0.6",
|
|
118
118
|
"vite-plugin-performance": "2.0.1",
|
|
119
119
|
"weapp-ide-cli": "5.0.4",
|
|
120
|
-
"wevu": "6.6.
|
|
120
|
+
"wevu": "6.6.6"
|
|
121
121
|
},
|
|
122
122
|
"publishConfig": {
|
|
123
123
|
"access": "public",
|
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
"bench": "vitest bench -c vitest.bench.config.ts",
|
|
160
160
|
"test:dev": "vitest",
|
|
161
161
|
"test": "vitest run",
|
|
162
|
+
"test:types": "cd test-d/auto-routes-define-app-json && tsd",
|
|
162
163
|
"sync": "cnpm sync weapp-vite"
|
|
163
164
|
}
|
|
164
165
|
}
|