weapp-vite 7.6.0 → 7.7.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/README.md +6 -4
- package/THIRD_PARTY_NOTICES.md +3 -3
- package/bin/bootstrap.js +9 -4
- package/bin/bootstrap.test.ts +82 -1
- package/bin/nodeVersionWarning.js +17 -0
- package/bin/nodeVersionWarning.test.ts +30 -0
- package/dist/{action-B3YZMA-h.mjs → action-BD56SQh4.mjs} +7 -8
- package/dist/{action-DlC6JYpt.mjs → action-CPtgEl6p.mjs} +9 -10
- package/dist/{action-BOk3vGI7.mjs → action-le0bNff_.mjs} +22 -30
- package/dist/{action-BELcDNNv.mjs → action-ytG5oFAw.mjs} +5 -6
- package/dist/{action-zEDY7oh_.mjs → action-zmJrU8PC.mjs} +11 -13
- package/dist/{analyze-DN79YOAH.mjs → analyze-DCZo-sJd.mjs} +3 -6
- package/dist/{artifacts-BOyC9Fy-.mjs → artifacts-TrTX9_jj.mjs} +2 -4
- package/dist/{assets-C5_YYXNk.mjs → assets-XyhpYtGl.mjs} +11 -18
- package/dist/auto-import-components/resolvers.d.mts +1 -1
- package/dist/auto-import-components/resolvers.mjs +1 -1
- package/dist/auto-import-presets/wevu-router.d.mts +1 -1
- package/dist/auto-import-presets/wevu-router.mjs +1 -1
- package/dist/auto-import-presets/wevu.d.mts +1 -1
- package/dist/auto-import-presets/wevu.mjs +1 -1
- package/dist/auto-import-presets.d.mts +2 -2
- package/dist/auto-import-presets.mjs +2 -2
- package/dist/auto-routes.d.mts +1 -3
- package/dist/auto-routes.mjs +3 -4
- package/dist/{budget-CTLOHwgI.d.mts → budget-DTPngJU0.d.mts} +1 -9
- package/dist/{budget-EOeEycc_.mjs → budget-_Mu-4GKn.mjs} +2 -4
- package/dist/{builtProject-C29udgXY.mjs → builtProject-B145uOt5.mjs} +11 -18
- package/dist/{classifier-DBJY__kg.mjs → classifier-CNTJOYQL.mjs} +4 -5
- package/dist/cli-acceptance.mjs +3 -4
- package/dist/cli.mjs +55 -86
- package/dist/{config-DRGcCi3h.mjs → config-59ZWhCIf.mjs} +1 -2
- package/dist/{config-Bf6DWhyb.d.mts → config-BNx2BODw.d.mts} +13 -105
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +3 -3
- package/dist/{constants-DEZdcsMn.mjs → constants-BOe8mgqL.mjs} +2 -4
- package/dist/{createCompilerContextInstance-aYwi8wQt.mjs → createCompilerContextInstance-BXSdH2E8.mjs} +1710 -1511
- package/dist/{createContext-tApLtII-.mjs → createContext-W0TeXxbo.mjs} +3 -4
- package/dist/dashboard/analyze.d.mts +1 -7
- package/dist/dashboard/analyze.mjs +2 -2
- package/dist/dashboard/vite.d.mts +2 -4
- package/dist/dashboard/vite.mjs +1 -2
- package/dist/dashboard.d.mts +2 -2
- package/dist/dashboard.mjs +20 -36
- package/dist/{dashboardTransport-C_Y6jMp-.mjs → dashboardTransport-C9290QgS.mjs} +1 -2
- package/dist/{dashboardViteBridge-DCGR43aM.mjs → dashboardViteBridge-B7QgQo94.mjs} +4 -7
- package/dist/{dev-C2fgr_Xd.mjs → dev-D1QSExwk.mjs} +2 -3
- package/dist/devProvider-Bcvz5nu4.mjs +4966 -0
- package/dist/docs/README.md +6 -4
- package/dist/docs/ai-workflows.md +2 -0
- package/dist/docs/mcp.md +1 -1
- package/dist/docs/troubleshooting.md +8 -0
- package/dist/docs/weapp-config.md +29 -0
- package/dist/docs/wevu-authoring.md +2 -0
- package/dist/doctor-worker.mjs +5 -6
- package/dist/doctor.d.mts +2 -8
- package/dist/doctor.mjs +16 -25
- package/dist/{engine-C66J0HLz.mjs → engine-Mnnm_ALP.mjs} +1 -2
- package/dist/file-5eEfbK60.mjs +1 -0
- package/dist/{file-CcIOmqhC.mjs → file-D8mp5GmB.mjs} +6 -10
- package/dist/{files-BqxFIPRp.mjs → files-Cy9jURJu.mjs} +1 -2
- package/dist/{forwardConsole-B0Reo8Lf.mjs → forwardConsole-D2Q0RIqc.mjs} +5 -7
- package/dist/getInstance-BXNVH7sU.mjs +1 -0
- package/dist/{getInstance-Dt9IQDKr.mjs → getInstance-DfNlbr-X.mjs} +2 -3
- package/dist/{history-BIiRCzbq.mjs → history-dKxzoHmN.mjs} +18 -28
- package/dist/i18n.d.mts +1 -3
- package/dist/i18n.mjs +1 -2
- package/dist/{index-D5rgBzYZ.d.mts → index-DIZJRrvK.d.mts} +1 -23
- package/dist/{index-CaXAtb9e.d.mts → index-SnaW3cvA.d.mts} +0 -12
- package/dist/index.d.mts +3 -7
- package/dist/index.mjs +6 -6
- package/dist/{json-BL8Dhhk6.mjs → json-Cvon2mw5.mjs} +1 -2
- package/dist/json.d.mts +1 -1
- package/dist/json.mjs +1 -1
- package/dist/{lib-DjccSI1B.mjs → lib-CJyMBzoe.mjs} +5 -8
- package/dist/{lifecycle-C36WSbQS.mjs → lifecycle-CUo8PMQc.mjs} +3 -6
- package/dist/{loadConfig-BWIsDXR4.mjs → loadConfig-CKIdfW4o.mjs} +2 -3
- package/dist/loadConfig-D4WGJcYp.mjs +1 -0
- package/dist/{logBuildAppFinish-ChjwATMv.mjs → logBuildAppFinish-DOBoof6S.mjs} +4 -7
- package/dist/{mcp-CYgX9HpO.mjs → mcp-D88QvQgG.mjs} +3 -5
- package/dist/{mcp-Cj8Maqo6.mjs → mcp-ovJgl1N9.mjs} +2 -4
- package/dist/mcp.d.mts +1 -3
- package/dist/mcp.mjs +1 -1
- package/dist/{mcpClient-DVLvFLZv.mjs → mcpClient-C8JzVZ46.mjs} +4 -8
- package/dist/{metadata-hwF7QRcS.mjs → metadata-HlDKtlsu.mjs} +1 -2
- package/dist/{nodeEnv-BmH8UZPR.mjs → nodeEnv-zq1EymWj.mjs} +1 -2
- package/dist/{openIde-CroqOgk5.mjs → openIde-QoYKhuuM.mjs} +8 -13
- package/dist/{options-jqFwfD1G.mjs → options-Cz8vZ-0w.mjs} +1 -2
- package/dist/{chunkStrategy-DY_LZIIe.mjs → package-DR62fAzP.mjs} +20 -31
- package/dist/{path-CYYIQGS7.mjs → path-E1OjBJAl.mjs} +1 -2
- package/dist/{platform-CnkySBKz.mjs → platform-BiMpsZIb.mjs} +1 -2
- package/dist/{pluginHost--CaeyWpA.mjs → pluginHost-vn8Vty1J.mjs} +1 -2
- package/dist/{processCleanup-BQn2kTcK.mjs → processCleanup-DzB64WI8.mjs} +1 -2
- package/dist/{protocol-Cg6Jdlvb.mjs → protocol-HiSJRrSO.mjs} +2 -3
- package/dist/{reader-sh_POQ9-.mjs → reader-wzPH_W8A.mjs} +1 -2
- package/dist/{realpathScope-Tf9mz-fh.mjs → realpathScope-DwlLaCk3.mjs} +1 -2
- package/dist/{report-hyonPGbZ.mjs → report-PJVyo-UZ.mjs} +2 -4
- package/dist/{resolvedId-CiDl7SC1.mjs → resolvedId-DaxPh_yV.mjs} +2 -4
- package/dist/{resolvers-Dod-euqX.mjs → resolvers-CKYqmRD_.mjs} +10 -20
- package/dist/resolvers.d.mts +1 -1
- package/dist/resolvers.mjs +1 -1
- package/dist/{routes-C7fCmf92.d.mts → routes-DvAFX29h.d.mts} +0 -2
- package/dist/{runtime-DpVf714f.d.mts → runtime-BL4RjBRa.d.mts} +0 -8
- package/dist/{runtime-CLUhQsdA.mjs → runtime-CKtMVERT.mjs} +2 -3
- package/dist/{runtime-D6VCNhNY.mjs → runtime-DDUCb7pP.mjs} +4 -8
- package/dist/runtime.d.mts +1 -1
- package/dist/runtime.mjs +1 -1
- package/dist/{schematics-kO26eQRT.mjs → schematics-DikfOjMD.mjs} +1 -2
- package/dist/{session-D3zsdzIy.mjs → session-COrQJYif.mjs} +16 -18
- package/dist/test.d.mts +1 -3
- package/dist/test.mjs +50 -28
- package/dist/{types-D0FFexRF.d.mts → types-BK2EQ3Jm.d.mts} +0 -2
- package/dist/{types-D-kfuyVa.d.mts → types-e2BMP9NU.d.mts} +0 -2
- package/dist/types.d.mts +4 -4
- package/dist/{upload-DozK8UdN.mjs → upload-Chal5b3w.mjs} +11 -21
- package/dist/upload-worker.mjs +3 -5
- package/dist/{utils-Dy51PYAC.mjs → utils-CTGSZp4j.mjs} +20 -34
- package/dist/vite.d.mts +2 -4
- package/dist/vite.mjs +9 -14
- package/dist/volar.mjs +1 -2
- package/dist/{wevu-BQWUU7br.mjs → wevu-BaihCXO9.mjs} +1 -2
- package/dist/wevu-DTtSOyxB.d.mts +3 -0
- package/dist/{wevu-router-Dg1LnBlg.mjs → wevu-router-BIoxDbnu.mjs} +1 -2
- package/dist/wevu-router-CdWurGQ4.d.mts +3 -0
- package/dist/wxs-7V7MPzeW.mjs +1 -0
- package/dist/{wxs-BT8btflA.mjs → wxs-BdHHXltv.mjs} +2 -4
- package/package.json +46 -43
- package/dist/devProvider-D-hTfsEO.mjs +0 -3027
- package/dist/file-DtcteQ4G.mjs +0 -1
- package/dist/getInstance-BAIaU2y9.mjs +0 -1
- package/dist/loadConfig-D-BpBgsk.mjs +0 -1
- package/dist/package-Cmakyy3J.mjs +0 -4
- package/dist/wevu-C4KEC5kO.d.mts +0 -5
- package/dist/wevu-router-Cg2sIkIE.d.mts +0 -5
- package/dist/wxs-Z4VQDeJ_.mjs +0 -1
package/dist/test.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/testArtifact.d.ts
|
|
2
1
|
export interface BuildTestArtifactOptions {
|
|
3
2
|
configFile?: string;
|
|
4
3
|
cwd?: string;
|
|
@@ -29,5 +28,4 @@ export declare function buildTestArtifact(options?: BuildTestArtifactOptions): P
|
|
|
29
28
|
projectPath: string;
|
|
30
29
|
sourceRootPath: string;
|
|
31
30
|
}>;
|
|
32
|
-
export declare function watchTestArtifact(options?: WatchTestArtifactOptions): Promise<WeappViteTestArtifactWatcher>;
|
|
33
|
-
//#endregion
|
|
31
|
+
export declare function watchTestArtifact(options?: WatchTestArtifactOptions): Promise<WeappViteTestArtifactWatcher>;
|
package/dist/test.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { m as captureWatchDependencies, u as CompilerSession } from "./createCompilerContextInstance-
|
|
2
|
-
import { a as parseSidecarModuleId, i as parseLogicalEntryId } from "./protocol-
|
|
3
|
-
import {
|
|
4
|
-
import { n as normalizePath, t as isPathInside } from "./path-
|
|
1
|
+
import { m as captureWatchDependencies, u as CompilerSession } from "./createCompilerContextInstance-BXSdH2E8.mjs";
|
|
2
|
+
import { a as parseSidecarModuleId, i as parseLogicalEntryId } from "./protocol-HiSJRrSO.mjs";
|
|
3
|
+
import { D as createSidecarWatchOptions, E as deduplicateCleanupErrors, T as createFileWatcher } from "./devProvider-Bcvz5nu4.mjs";
|
|
4
|
+
import { n as normalizePath, t as isPathInside } from "./path-E1OjBJAl.mjs";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import fs from "node:fs/promises";
|
|
8
8
|
import { createHash, randomUUID } from "node:crypto";
|
|
9
|
-
|
|
9
|
+
// src/testArtifact/inputs.ts
|
|
10
10
|
const sessionId = randomUUID();
|
|
11
11
|
const excludedDirectories = /* @__PURE__ */ new Set([
|
|
12
12
|
".git",
|
|
@@ -70,10 +70,34 @@ async function fingerprintPaths(paths, excluded = []) {
|
|
|
70
70
|
for (const file of [...new Set(paths)].sort()) await visit(path.resolve(file));
|
|
71
71
|
return hash.digest("hex");
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
//#region src/testArtifact.ts
|
|
73
|
+
// src/testArtifact.ts
|
|
75
74
|
let pendingBuild = Promise.resolve();
|
|
76
75
|
const artifactInputs = /* @__PURE__ */ new WeakMap();
|
|
76
|
+
/** 监听策略属于产物启动快照,后续编译配置变动不能改写已登记策略。 */
|
|
77
|
+
function captureArtifactWatchConfig(config) {
|
|
78
|
+
const inline = config.inlineConfig;
|
|
79
|
+
const buildWatch = inline?.build?.watch;
|
|
80
|
+
const serverWatch = inline?.server?.watch;
|
|
81
|
+
const watchOptions = createSidecarWatchOptions(config, {});
|
|
82
|
+
const buildChokidar = buildWatch && typeof buildWatch === "object" && "chokidar" in buildWatch ? buildWatch.chokidar : void 0;
|
|
83
|
+
return { inlineConfig: {
|
|
84
|
+
...inline,
|
|
85
|
+
build: {
|
|
86
|
+
...inline?.build,
|
|
87
|
+
watch: {
|
|
88
|
+
...buildWatch && typeof buildWatch === "object" ? buildWatch : {},
|
|
89
|
+
chokidar: {
|
|
90
|
+
...buildChokidar,
|
|
91
|
+
...watchOptions
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
server: inline?.server ? {
|
|
96
|
+
...inline.server,
|
|
97
|
+
watch: serverWatch && typeof serverWatch === "object" ? { ...serverWatch } : serverWatch
|
|
98
|
+
} : void 0
|
|
99
|
+
} };
|
|
100
|
+
}
|
|
77
101
|
function enqueueBuild(task) {
|
|
78
102
|
const result = pendingBuild.then(task, task);
|
|
79
103
|
pendingBuild = result.then(() => void 0, () => void 0);
|
|
@@ -125,6 +149,7 @@ async function buildTestArtifact(options = {}) {
|
|
|
125
149
|
preloadAppEntry: false,
|
|
126
150
|
syncSupportFiles: false
|
|
127
151
|
});
|
|
152
|
+
const watchConfig = captureArtifactWatchConfig(ctx.configService);
|
|
128
153
|
for (const file of ctx.configService.configFileDependencies ?? []) dependencies.add(file);
|
|
129
154
|
if (options.projectConfigPath) dependencies.add(path.resolve(cwd, options.projectConfigPath));
|
|
130
155
|
dependencies.add(ctx.configService.absoluteSrcRoot);
|
|
@@ -142,7 +167,8 @@ async function buildTestArtifact(options = {}) {
|
|
|
142
167
|
const stable = (await Promise.all([...discoveredInputs].map(async ([file, fingerprint]) => await fingerprint === await fingerprintPaths([file])))).every(Boolean) && before === await fingerprintPaths(initialInputs, [outDir]);
|
|
143
168
|
artifactInputs.set(artifact, {
|
|
144
169
|
paths,
|
|
145
|
-
fingerprint: stable ? fingerprint : ""
|
|
170
|
+
fingerprint: stable ? fingerprint : "",
|
|
171
|
+
watchConfig
|
|
146
172
|
});
|
|
147
173
|
return artifact;
|
|
148
174
|
} finally {
|
|
@@ -160,13 +186,18 @@ async function watchTestArtifact(options = {}) {
|
|
|
160
186
|
let closing;
|
|
161
187
|
const watchedInputs = () => [...new Map(artifactInputs.get(artifact).paths.map((file) => [normalizePath(file), file])).values()].filter((file) => !isPathInside(artifact.miniprogramRootPath, file) && (normalizePath(file) === normalizePath(artifact.sourceRootPath) || !isPathInside(artifact.sourceRootPath, file)));
|
|
162
188
|
let watched = watchedInputs();
|
|
163
|
-
const watcher =
|
|
189
|
+
const watcher = createFileWatcher(artifactInputs.get(artifact).watchConfig, watched, {
|
|
164
190
|
ignoreInitial: true,
|
|
165
191
|
ignored(file) {
|
|
166
192
|
if (watched.some((input) => isPathInside(file, input))) return false;
|
|
167
193
|
return /[/\\](?:node_modules|\.git|\.weapp-vite)(?:[/\\]|$)/.test(file) || isPathInside(artifact.miniprogramRootPath, file);
|
|
168
194
|
}
|
|
169
195
|
});
|
|
196
|
+
const closeResources = async (priorFailures = []) => {
|
|
197
|
+
const results = await Promise.allSettled([watcher.close(), active]);
|
|
198
|
+
const failures = deduplicateCleanupErrors([...priorFailures, ...results.filter((result) => result.status === "rejected").map((result) => result.reason)]);
|
|
199
|
+
if (failures.length) throw failures.length === 1 ? failures[0] : new AggregateError(failures, "Test artifact watcher cleanup failed", { cause: failures[0] });
|
|
200
|
+
};
|
|
170
201
|
const requestRebuild = (force) => {
|
|
171
202
|
if (closed) return Promise.reject(/* @__PURE__ */ new Error("The weapp-vite test artifact watcher has already closed."));
|
|
172
203
|
dirty = true;
|
|
@@ -180,10 +211,8 @@ async function watchTestArtifact(options = {}) {
|
|
|
180
211
|
if (closed) break;
|
|
181
212
|
artifact = await buildTestArtifact(options);
|
|
182
213
|
if (!closed) {
|
|
183
|
-
|
|
184
|
-
await watcher.
|
|
185
|
-
watched = next;
|
|
186
|
-
watcher.add(watched);
|
|
214
|
+
watched = watchedInputs();
|
|
215
|
+
await watcher.updateTargets(watched);
|
|
187
216
|
await options.onRebuilt?.(artifact);
|
|
188
217
|
}
|
|
189
218
|
if (closed) break;
|
|
@@ -203,21 +232,18 @@ async function watchTestArtifact(options = {}) {
|
|
|
203
232
|
});
|
|
204
233
|
}, 20);
|
|
205
234
|
};
|
|
206
|
-
watcher.
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
watcher.
|
|
235
|
+
watcher.onChange((changes) => {
|
|
236
|
+
if (changes.some((change) => change.kind === "file")) scheduleRebuild();
|
|
237
|
+
});
|
|
238
|
+
watcher.onError((error) => options.onError?.(error));
|
|
210
239
|
try {
|
|
211
|
-
await
|
|
212
|
-
watcher.once("ready", resolve);
|
|
213
|
-
watcher.once("error", reject);
|
|
214
|
-
});
|
|
240
|
+
await watcher.ready;
|
|
215
241
|
if (!await isTestArtifactCurrent(artifact)) await requestRebuild(false);
|
|
216
242
|
} catch (error) {
|
|
217
243
|
closed = true;
|
|
218
244
|
if (scheduled) clearTimeout(scheduled);
|
|
219
|
-
|
|
220
|
-
await
|
|
245
|
+
closing = closeResources([error]);
|
|
246
|
+
await closing;
|
|
221
247
|
throw error;
|
|
222
248
|
}
|
|
223
249
|
return {
|
|
@@ -228,14 +254,10 @@ async function watchTestArtifact(options = {}) {
|
|
|
228
254
|
if (closing) return closing;
|
|
229
255
|
closed = true;
|
|
230
256
|
if (scheduled) clearTimeout(scheduled);
|
|
231
|
-
closing = (
|
|
232
|
-
await watcher.close();
|
|
233
|
-
await active?.catch(() => void 0);
|
|
234
|
-
})();
|
|
257
|
+
closing = closeResources();
|
|
235
258
|
return closing;
|
|
236
259
|
},
|
|
237
260
|
rebuild: () => requestRebuild(true)
|
|
238
261
|
};
|
|
239
262
|
}
|
|
240
|
-
//#endregion
|
|
241
263
|
export { buildTestArtifact, isTestArtifactCurrent, watchTestArtifact };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/analyze/glassEasel/types.d.ts
|
|
2
1
|
type GlassEaselDiagnosticCode = 'GE001' | 'GE002' | 'GE003' | 'GE004' | 'GE005' | 'GE006';
|
|
3
2
|
type GlassEaselDiagnosticSeverity = 'error' | 'warning';
|
|
4
3
|
interface GlassEaselDiagnostic {
|
|
@@ -35,5 +34,4 @@ interface GlassEaselTemplateFinding {
|
|
|
35
34
|
start: number;
|
|
36
35
|
normalized?: boolean;
|
|
37
36
|
}
|
|
38
|
-
//#endregion
|
|
39
37
|
export { GlassEaselAnalyzeResult as n, GlassEaselTemplateFinding as r, GlassEaselAnalysisFact as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import "@weapp-vite/i18n/types";
|
|
2
|
-
//#region src/i18n/types.d.ts
|
|
3
2
|
interface WeappI18nConfig {
|
|
4
3
|
defaultLocale: string;
|
|
5
4
|
fallbackLocale?: string;
|
|
@@ -7,5 +6,4 @@ interface WeappI18nConfig {
|
|
|
7
6
|
functionName?: string;
|
|
8
7
|
moduleName?: string;
|
|
9
8
|
}
|
|
10
|
-
//#endregion
|
|
11
9
|
export { WeappI18nConfig as t };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as Resolver } from "./index-
|
|
2
|
-
import { n as AutoRoutesSubPackage, t as AutoRoutes } from "./routes-
|
|
3
|
-
import { $ as WeappCompilerOutputRequest, $n as NpmPackageFilesConfig, $t as WeappUniAppConfig, A as Ref, An as GenerateDirsOptions, At as WeappAppPreludeConfig, B as BindingErrorLike, Bn as GenerateTemplateInlineSource, Br as WeappViteRuntime, Bt as WeappInjectWeapiConfig, Cn as AliasOptions, Cr as WeappLibVueTscOptions, Ct as AutoImportComponents, D as MethodDefinitions, Dn as CopyGlobs, Dr as WeappManagedSharedTsconfigConfig, Dt as HandleWxmlOptions, E as InlineConfig, En as ChunksConfig, Er as WeappManagedServerTsconfigConfig, Et as EnhanceWxmlOptions, F as RolldownPlugin, Fn as GenerateTemplate, Ft as WeappBuildScopeConfig, G as EntryJsonFragment, Gn as JsonMergeContext, Gt as WeappPreloadNetwork, H as BaseEntry, Hn as GenerateTemplatesConfig, Ht as WeappInjectWebRuntimeGlobalsTarget, I as RolldownPluginOption, In as GenerateTemplateContext, It as WeappBuildScopeObjectConfig, J as ScanComponentItem, Jn as JsonMergeStrategy, Jt as WeappReactConfig, K as PageEntry, Kn as JsonMergeFunction, Kt as WeappPreloadRule, L as RolldownWatchOptions, Ln as GenerateTemplateEntry, Lt as WeappHmrConfig, M as RolldownBuild, Mn as GenerateFileType, Mt as WeappAutoRoutesConfig, N as RolldownOptions, Nn as GenerateFilenamesOptions, Nt as WeappAutoRoutesInclude, O as Plugin, On as CopyOptions, Or as WeappManagedTypeScriptConfig, Ot as MultiPlatformConfig, P as RolldownOutput, Pn as GenerateOptions, Pt as WeappAutoRoutesIncludePattern, Q as WeappCompilerHmrRequest, Qn as NpmMainPackageConfig, Qt as WeappSubPackageConfig, R as RolldownWatcher, Rn as GenerateTemplateFactory, Rt as WeappInjectRequestGlobalsConfig, Sn as Alias, Sr as WeappLibInternalDtsOptions, St as WeappViteConfig, T as ConfigEnv, Tn as BuildNpmPackageMeta, Tr as WeappManagedNodeTsconfigConfig, Tt as EnhanceOptions, U as ComponentEntry, Un as JsFormat, Ut as WeappMcpConfig, V as AppEntry, Vn as GenerateTemplateScope, Vt as WeappInjectWebRuntimeGlobalsConfig, W as Entry, Wn as JsonConfig, Wt as WeappNpmConfig, X as WeappCompilerHmrAsset, Xn as NpmBuildOptions, Xt as WeappRouteRule, Y as WxmlDep, Yn as MpPlatform, Yt as WeappRequestRuntimeConfig, Z as WeappCompilerHmrPreparation, Zn as NpmDependencyPattern, Zt as WeappRouteRules, _n as WxmlTransformNode, _r as WeappLibComponentJson, _t as WeappDebugConfig, an as WxmlRemoveAttrRule, ar as SharedChunkMode, at as WeappCompilerPluginOption, b as ChangeEvent, bn as MultiPlatformProjectConfig, br as WeappLibEntryContext, bt as WeappTailwindcssOptions, cn as WxmlValidationContext, cr as StyleConfigEntry, ct as WeappCompilerSourceClaim, dn as WxmlAttribute, dr as StyleScope, dt as ProjectConfig, en as WeappVueConfig, er as NpmPluginPackageConfig, et as WeappCompilerPlugin, fn as WxmlAttributeValue, fr as SubPackage, ft as SubPackageMetaValue, gn as WxmlTransformContext, gr as SubPackageStyleScope, gt as WeappAnalyzeHistoryConfig, hn as WxmlTransform, hr as SubPackageStyleEntry, ht as WeappAnalyzeConfig, in as WeappWorkerConfig, ir as SharedChunkDynamicImports, it as WeappCompilerPluginFactory, j as ResolvedConfig, jn as GenerateExtensionsOptions, jr as WeappViteHostMeta, jt as WeappAppPreludeMode, k as PluginOption, kn as DeprecatedInlineDynamicImports, kr as WeappWebConfig, kt as ScanWxmlOptions, ln as WxmlValidationDiagnostic, lr as StyleConfigObject, lt as WeappCompilerSourceRequest, mn as WxmlSourceLocation, mr as SubPackageStyleConfigObject, mt as WeappAnalyzeBudgetConfig, nn as WeappWebRuntimeConfig, nr as NpmSubPackageConfig, nt as WeappCompilerPluginContext, on as WxmlRemoveOptions, or as SharedChunkOverride, ot as WeappCompilerPluginPhase, pn as WxmlElementInfo, pr as SubPackageStyleConfigEntry, pt as UserConfig, q as ComponentsMap, qn as JsonMergeStage, qt as WeappReactCompilerConfig, rn as WeappWevuConfig, rr as ResolvedAlias, rt as WeappCompilerPluginController, sn as WxmlValidate, sr as SharedChunkStrategy, st as WeappCompilerResourceKind, tn as WeappVueTemplateConfig, tr as NpmStrategy, tt as WeappCompilerPluginCapabilities, un as WxmlValidationVisitor, ur as StyleEntry, ut as WeappCompilerTransformResult, vn as WxmlTransformResult, vr as WeappLibConfig, vt as WeappForwardConsoleConfig, w as ComputedDefinitions, wn as AlipayNpmMode, wr as WeappManagedAppTsconfigConfig, wt as AutoImportComponentsOption, x as WeappVitePluginApi, xn as MultiPlatformProjectConfigs, xr as WeappLibFileName, xt as WeappUploadConfig, yn as WxmlTransformVisitor, yr as WeappLibDtsOptions, yt as WeappForwardConsoleLogLevel, z as ViteDevServer, zn as GenerateTemplateFileSource, zt as WeappInjectRequestGlobalsTarget } from "./config-
|
|
4
|
-
import { t as WeappI18nConfig } from "./types-
|
|
1
|
+
import { f as Resolver } from "./index-SnaW3cvA.mjs";
|
|
2
|
+
import { n as AutoRoutesSubPackage, t as AutoRoutes } from "./routes-DvAFX29h.mjs";
|
|
3
|
+
import { $ as WeappCompilerOutputRequest, $n as NpmPackageFilesConfig, $t as WeappUniAppConfig, A as Ref, An as GenerateDirsOptions, At as WeappAppPreludeConfig, B as BindingErrorLike, Bn as GenerateTemplateInlineSource, Br as WeappViteRuntime, Bt as WeappInjectWeapiConfig, Cn as AliasOptions, Cr as WeappLibVueTscOptions, Ct as AutoImportComponents, D as MethodDefinitions, Dn as CopyGlobs, Dr as WeappManagedSharedTsconfigConfig, Dt as HandleWxmlOptions, E as InlineConfig, En as ChunksConfig, Er as WeappManagedServerTsconfigConfig, Et as EnhanceWxmlOptions, F as RolldownPlugin, Fn as GenerateTemplate, Ft as WeappBuildScopeConfig, G as EntryJsonFragment, Gn as JsonMergeContext, Gt as WeappPreloadNetwork, H as BaseEntry, Hn as GenerateTemplatesConfig, Ht as WeappInjectWebRuntimeGlobalsTarget, I as RolldownPluginOption, In as GenerateTemplateContext, It as WeappBuildScopeObjectConfig, J as ScanComponentItem, Jn as JsonMergeStrategy, Jt as WeappReactConfig, K as PageEntry, Kn as JsonMergeFunction, Kt as WeappPreloadRule, L as RolldownWatchOptions, Ln as GenerateTemplateEntry, Lt as WeappHmrConfig, M as RolldownBuild, Mn as GenerateFileType, Mt as WeappAutoRoutesConfig, N as RolldownOptions, Nn as GenerateFilenamesOptions, Nt as WeappAutoRoutesInclude, O as Plugin, On as CopyOptions, Or as WeappManagedTypeScriptConfig, Ot as MultiPlatformConfig, P as RolldownOutput, Pn as GenerateOptions, Pt as WeappAutoRoutesIncludePattern, Q as WeappCompilerHmrRequest, Qn as NpmMainPackageConfig, Qt as WeappSubPackageConfig, R as RolldownWatcher, Rn as GenerateTemplateFactory, Rt as WeappInjectRequestGlobalsConfig, Sn as Alias, Sr as WeappLibInternalDtsOptions, St as WeappViteConfig, T as ConfigEnv, Tn as BuildNpmPackageMeta, Tr as WeappManagedNodeTsconfigConfig, Tt as EnhanceOptions, U as ComponentEntry, Un as JsFormat, Ut as WeappMcpConfig, V as AppEntry, Vn as GenerateTemplateScope, Vt as WeappInjectWebRuntimeGlobalsConfig, W as Entry, Wn as JsonConfig, Wt as WeappNpmConfig, X as WeappCompilerHmrAsset, Xn as NpmBuildOptions, Xt as WeappRouteRule, Y as WxmlDep, Yn as MpPlatform, Yt as WeappRequestRuntimeConfig, Z as WeappCompilerHmrPreparation, Zn as NpmDependencyPattern, Zt as WeappRouteRules, _n as WxmlTransformNode, _r as WeappLibComponentJson, _t as WeappDebugConfig, an as WxmlRemoveAttrRule, ar as SharedChunkMode, at as WeappCompilerPluginOption, b as ChangeEvent, bn as MultiPlatformProjectConfig, br as WeappLibEntryContext, bt as WeappTailwindcssOptions, cn as WxmlValidationContext, cr as StyleConfigEntry, ct as WeappCompilerSourceClaim, dn as WxmlAttribute, dr as StyleScope, dt as ProjectConfig, en as WeappVueConfig, er as NpmPluginPackageConfig, et as WeappCompilerPlugin, fn as WxmlAttributeValue, fr as SubPackage, ft as SubPackageMetaValue, gn as WxmlTransformContext, gr as SubPackageStyleScope, gt as WeappAnalyzeHistoryConfig, hn as WxmlTransform, hr as SubPackageStyleEntry, ht as WeappAnalyzeConfig, in as WeappWorkerConfig, ir as SharedChunkDynamicImports, it as WeappCompilerPluginFactory, j as ResolvedConfig, jn as GenerateExtensionsOptions, jr as WeappViteHostMeta, jt as WeappAppPreludeMode, k as PluginOption, kn as DeprecatedInlineDynamicImports, kr as WeappWebConfig, kt as ScanWxmlOptions, ln as WxmlValidationDiagnostic, lr as StyleConfigObject, lt as WeappCompilerSourceRequest, mn as WxmlSourceLocation, mr as SubPackageStyleConfigObject, mt as WeappAnalyzeBudgetConfig, nn as WeappWebRuntimeConfig, nr as NpmSubPackageConfig, nt as WeappCompilerPluginContext, on as WxmlRemoveOptions, or as SharedChunkOverride, ot as WeappCompilerPluginPhase, pn as WxmlElementInfo, pr as SubPackageStyleConfigEntry, pt as UserConfig, q as ComponentsMap, qn as JsonMergeStage, qt as WeappReactCompilerConfig, rn as WeappWevuConfig, rr as ResolvedAlias, rt as WeappCompilerPluginController, sn as WxmlValidate, sr as SharedChunkStrategy, st as WeappCompilerResourceKind, tn as WeappVueTemplateConfig, tr as NpmStrategy, tt as WeappCompilerPluginCapabilities, un as WxmlValidationVisitor, ur as StyleEntry, ut as WeappCompilerTransformResult, vn as WxmlTransformResult, vr as WeappLibConfig, vt as WeappForwardConsoleConfig, w as ComputedDefinitions, wn as AlipayNpmMode, wr as WeappManagedAppTsconfigConfig, wt as AutoImportComponentsOption, x as WeappVitePluginApi, xn as MultiPlatformProjectConfigs, xr as WeappLibFileName, xt as WeappUploadConfig, yn as WxmlTransformVisitor, yr as WeappLibDtsOptions, yt as WeappForwardConsoleLogLevel, z as ViteDevServer, zn as GenerateTemplateFileSource, zt as WeappInjectRequestGlobalsTarget } from "./config-BNx2BODw.mjs";
|
|
4
|
+
import { t as WeappI18nConfig } from "./types-e2BMP9NU.mjs";
|
|
5
5
|
export { Alias, AliasOptions, AlipayNpmMode, AppEntry, AutoImportComponents, AutoImportComponentsOption, AutoRoutes, AutoRoutesSubPackage, BaseEntry, BindingErrorLike, BuildNpmPackageMeta, ChangeEvent, ChunksConfig, ComponentEntry, ComponentsMap, type ComputedDefinitions, type ConfigEnv, CopyGlobs, CopyOptions, DeprecatedInlineDynamicImports, EnhanceOptions, EnhanceWxmlOptions, Entry, EntryJsonFragment, GenerateDirsOptions, GenerateExtensionsOptions, GenerateFileType, GenerateFilenamesOptions, GenerateOptions, GenerateTemplate, GenerateTemplateContext, GenerateTemplateEntry, GenerateTemplateFactory, GenerateTemplateFileSource, GenerateTemplateInlineSource, GenerateTemplateScope, GenerateTemplatesConfig, HandleWxmlOptions, type InlineConfig, JsFormat, type JsonConfig, type JsonMergeContext, type JsonMergeFunction, type JsonMergeStage, type JsonMergeStrategy, type MethodDefinitions, MpPlatform, MultiPlatformConfig, MultiPlatformProjectConfig, MultiPlatformProjectConfigs, NpmBuildOptions, NpmDependencyPattern, NpmMainPackageConfig, NpmPackageFilesConfig, NpmPluginPackageConfig, NpmStrategy, NpmSubPackageConfig, PageEntry, type Plugin, type PluginOption, ProjectConfig, type Ref, ResolvedAlias, type ResolvedConfig, type Resolver, type RolldownBuild, type RolldownOptions, type RolldownOutput, type RolldownPlugin, type RolldownPluginOption, type RolldownWatchOptions, type RolldownWatcher, ScanComponentItem, ScanWxmlOptions, SharedChunkDynamicImports, SharedChunkMode, SharedChunkOverride, SharedChunkStrategy, StyleConfigEntry, StyleConfigObject, StyleEntry, StyleScope, SubPackage, SubPackageMetaValue, SubPackageStyleConfigEntry, SubPackageStyleConfigObject, SubPackageStyleEntry, SubPackageStyleScope, UserConfig, type ViteDevServer, WeappAnalyzeBudgetConfig, WeappAnalyzeConfig, WeappAnalyzeHistoryConfig, WeappAppPreludeConfig, WeappAppPreludeMode, WeappAutoRoutesConfig, WeappAutoRoutesInclude, WeappAutoRoutesIncludePattern, WeappBuildScopeConfig, WeappBuildScopeObjectConfig, type WeappCompilerHmrAsset, type WeappCompilerHmrPreparation, type WeappCompilerHmrRequest, WeappCompilerOutputRequest, WeappCompilerPlugin, WeappCompilerPluginCapabilities, WeappCompilerPluginContext, WeappCompilerPluginController, WeappCompilerPluginFactory, WeappCompilerPluginOption, WeappCompilerPluginPhase, WeappCompilerResourceKind, WeappCompilerSourceClaim, WeappCompilerSourceRequest, WeappCompilerTransformResult, WeappDebugConfig, WeappForwardConsoleConfig, WeappForwardConsoleLogLevel, WeappHmrConfig, type WeappI18nConfig, WeappInjectRequestGlobalsConfig, WeappInjectRequestGlobalsTarget, WeappInjectWeapiConfig, WeappInjectWebRuntimeGlobalsConfig, WeappInjectWebRuntimeGlobalsTarget, WeappLibComponentJson, WeappLibConfig, WeappLibDtsOptions, WeappLibEntryContext, WeappLibFileName, WeappLibInternalDtsOptions, WeappLibVueTscOptions, WeappManagedAppTsconfigConfig, WeappManagedNodeTsconfigConfig, WeappManagedServerTsconfigConfig, WeappManagedSharedTsconfigConfig, WeappManagedTypeScriptConfig, WeappMcpConfig, WeappNpmConfig, WeappPreloadNetwork, WeappPreloadRule, WeappReactCompilerConfig, WeappReactConfig, WeappRequestRuntimeConfig, WeappRouteRule, WeappRouteRules, WeappSubPackageConfig, WeappTailwindcssOptions, WeappUniAppConfig, WeappUploadConfig, WeappViteConfig, type WeappViteHostMeta, WeappVitePluginApi, type WeappViteRuntime, WeappVueConfig, WeappVueTemplateConfig, WeappWebConfig, WeappWebRuntimeConfig, WeappWevuConfig, WeappWorkerConfig, WxmlAttribute, WxmlAttributeValue, WxmlDep, WxmlElementInfo, WxmlRemoveAttrRule, WxmlRemoveOptions, WxmlSourceLocation, WxmlTransform, WxmlTransformContext, WxmlTransformNode, WxmlTransformResult, WxmlTransformVisitor, WxmlValidate, WxmlValidationContext, WxmlValidationDiagnostic, WxmlValidationVisitor };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as resolveMiniPlatform } from "./platform-
|
|
1
|
+
import { m as resolveMiniPlatform } from "./platform-BiMpsZIb.mjs";
|
|
2
2
|
import { r as logger_default } from "./logger-DGn5iEVN.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import process from "node:process";
|
|
@@ -9,7 +9,7 @@ import { getPackageInfo } from "local-pkg";
|
|
|
9
9
|
import { Buffer } from "node:buffer";
|
|
10
10
|
import { performance } from "node:perf_hooks";
|
|
11
11
|
import { execFile, execFileSync } from "node:child_process";
|
|
12
|
-
|
|
12
|
+
// src/cli/upload/processTreeDiagnostics.ts
|
|
13
13
|
const diagnostics = /* @__PURE__ */ new WeakMap();
|
|
14
14
|
const MARKER_PREFIX = "[weapp-vite:upload-process-tree:v1]";
|
|
15
15
|
const MARKER_RE = /^\[weapp-vite:upload-process-tree:v1\] (script-enter|parent-query-start|parent-query-end|children-query-start|children-query-end) (\d{1,9}) (\d{1,16})$/;
|
|
@@ -110,8 +110,7 @@ function describeUploadProcessTreeError(error) {
|
|
|
110
110
|
const diagnostic = error && typeof error === "object" ? diagnostics.get(error) : void 0;
|
|
111
111
|
return diagnostic ? `PowerShell 进程归属查询失败 ${JSON.stringify(diagnostic)}` : String(error);
|
|
112
112
|
}
|
|
113
|
-
|
|
114
|
-
//#region src/cli/upload/processTree.ts
|
|
113
|
+
// src/cli/upload/processTree.ts
|
|
115
114
|
function childPids(pid, lifetime) {
|
|
116
115
|
if (process.platform === "win32") {
|
|
117
116
|
const since = lifetime ? `[DateTimeOffset]::FromUnixTimeMilliseconds(${lifetime.start}).UtcDateTime` : `(Get-CimInstance Win32_Process -Filter 'ProcessId = ${pid}').CreationDate.ToUniversalTime()`;
|
|
@@ -219,8 +218,7 @@ function terminateUploadProcess(pid, options) {
|
|
|
219
218
|
function terminateUploadDescendants(pid) {
|
|
220
219
|
for (const child of childPids(pid)) terminateUploadProcess(child);
|
|
221
220
|
}
|
|
222
|
-
|
|
223
|
-
//#region src/cli/upload/tools.ts
|
|
221
|
+
// src/cli/upload/tools.ts
|
|
224
222
|
function requireUploadEnv(context, name) {
|
|
225
223
|
const value = context.env[name]?.trim();
|
|
226
224
|
if (!value) throw new Error(`上传缺少环境变量 ${name}。请通过环境变量或项目 .env 文件配置凭据。`);
|
|
@@ -283,8 +281,7 @@ async function runUploadCli(context, packageName, binName, args, secrets, captur
|
|
|
283
281
|
child.stdin?.end();
|
|
284
282
|
});
|
|
285
283
|
}
|
|
286
|
-
|
|
287
|
-
//#region src/cli/upload/providers/alipay.ts
|
|
284
|
+
// src/cli/upload/providers/alipay.ts
|
|
288
285
|
/** 校验支付宝身份密钥及上传版本,只在执行阶段加载并调用官方 SDK。 */
|
|
289
286
|
async function prepareAlipayUpload(context, action = "upload") {
|
|
290
287
|
const appId = requireUploadAppId({
|
|
@@ -355,8 +352,7 @@ async function prepareAlipayUpload(context, action = "upload") {
|
|
|
355
352
|
}
|
|
356
353
|
};
|
|
357
354
|
}
|
|
358
|
-
|
|
359
|
-
//#region src/cli/upload/providers/douyin.ts
|
|
355
|
+
// src/cli/upload/providers/douyin.ts
|
|
360
356
|
/** 校验抖音项目与 Token 对应的 AppID,仅在执行阶段调用官方上传或预览 SDK。 */
|
|
361
357
|
async function prepareDouyinUpload(context, action = "upload") {
|
|
362
358
|
const token = requireUploadEnv(context, "TT_UPLOAD_TOKEN");
|
|
@@ -399,8 +395,7 @@ async function prepareDouyinUpload(context, action = "upload") {
|
|
|
399
395
|
}
|
|
400
396
|
};
|
|
401
397
|
}
|
|
402
|
-
|
|
403
|
-
//#region src/cli/upload/providers/jd.ts
|
|
398
|
+
// src/cli/upload/providers/jd.ts
|
|
404
399
|
/** 京东 SDK 不解析 IDE 配置,需要将项目根目录转换为 app.json 所在目录。 */
|
|
405
400
|
async function prepareJdUpload(context, action = "upload") {
|
|
406
401
|
const privateKey = requireUploadEnv(context, "JD_PRIVATE_KEY");
|
|
@@ -452,8 +447,7 @@ async function prepareJdUpload(context, action = "upload") {
|
|
|
452
447
|
}
|
|
453
448
|
};
|
|
454
449
|
}
|
|
455
|
-
|
|
456
|
-
//#region src/cli/upload/providers/swan.ts
|
|
450
|
+
// src/cli/upload/providers/swan.ts
|
|
457
451
|
/** 使用官方百度 CLI 上传或预览普通小程序,JSON 模式会在认证失败时拒绝交互登录。 */
|
|
458
452
|
async function prepareSwanUpload(context, action = "upload") {
|
|
459
453
|
const token = requireUploadEnv(context, "SWAN_UPLOAD_TOKEN");
|
|
@@ -527,8 +521,7 @@ async function prepareSwanUpload(context, action = "upload") {
|
|
|
527
521
|
}
|
|
528
522
|
};
|
|
529
523
|
}
|
|
530
|
-
|
|
531
|
-
//#region src/cli/upload/providers/wechat.ts
|
|
524
|
+
// src/cli/upload/providers/wechat.ts
|
|
532
525
|
/** 校验微信凭据,SDK 自行读取 IDE 项目中的 miniprogramRoot。 */
|
|
533
526
|
async function prepareWechatUpload(context, action = "upload") {
|
|
534
527
|
const appid = requireUploadAppId({
|
|
@@ -591,8 +584,7 @@ async function prepareWechatUpload(context, action = "upload") {
|
|
|
591
584
|
}
|
|
592
585
|
};
|
|
593
586
|
}
|
|
594
|
-
|
|
595
|
-
//#region src/cli/upload/providers/xhs.ts
|
|
587
|
+
// src/cli/upload/providers/xhs.ts
|
|
596
588
|
/** 使用独立的官方 CI 实例上传或预览小红书项目,禁止回退到扫码登录。 */
|
|
597
589
|
async function prepareXhsUpload(context, action = "upload") {
|
|
598
590
|
const token = requireUploadEnv(context, "XHS_UPLOAD_TOKEN");
|
|
@@ -638,8 +630,7 @@ async function prepareXhsUpload(context, action = "upload") {
|
|
|
638
630
|
}
|
|
639
631
|
};
|
|
640
632
|
}
|
|
641
|
-
|
|
642
|
-
//#region src/cli/upload/index.ts
|
|
633
|
+
// src/cli/upload/index.ts
|
|
643
634
|
const providers = {
|
|
644
635
|
weapp: prepareWechatUpload,
|
|
645
636
|
alipay: prepareAlipayUpload,
|
|
@@ -662,5 +653,4 @@ function prepareUpload(platform, context, action = "upload") {
|
|
|
662
653
|
if (!Object.hasOwn(providers, platform)) throw new Error(`不支持上传或预览平台 "${platform}"。`);
|
|
663
654
|
return providers[platform](context, action);
|
|
664
655
|
}
|
|
665
|
-
//#endregion
|
|
666
656
|
export { terminateUploadProcess as a, terminateUploadDescendants as i, resolveUploadPlatforms as n, describeUploadProcessTreeError as o, redactUploadSecrets as r, prepareUpload as t };
|
package/dist/upload-worker.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as terminateUploadDescendants, r as redactUploadSecrets, t as prepareUpload } from "./upload-
|
|
1
|
+
import { i as terminateUploadDescendants, r as redactUploadSecrets, t as prepareUpload } from "./upload-Chal5b3w.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
|
-
|
|
3
|
+
// src/cli/upload/uploadResult.ts
|
|
4
4
|
function record(value) {
|
|
5
5
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
6
6
|
}
|
|
@@ -86,8 +86,7 @@ function normalizeUploadResult(platform, value, secrets) {
|
|
|
86
86
|
}
|
|
87
87
|
return result;
|
|
88
88
|
}
|
|
89
|
-
|
|
90
|
-
//#region src/cli/upload/worker.ts
|
|
89
|
+
// src/cli/upload/worker.ts
|
|
91
90
|
process.once("disconnect", () => process.exit(1));
|
|
92
91
|
process.once("SIGINT", () => process.exit(1));
|
|
93
92
|
process.once("SIGTERM", () => process.exit(1));
|
|
@@ -157,5 +156,4 @@ try {
|
|
|
157
156
|
const message = error instanceof Error ? error.message : String(error);
|
|
158
157
|
process.stderr.write(`${message}\n`, () => process.exit(1));
|
|
159
158
|
}
|
|
160
|
-
//#endregion
|
|
161
159
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { n as normalizeFsResolvedId, t as isSkippableResolvedId } from "./resolvedId-
|
|
2
|
-
import { i as normalizeRoot, s as toPosixPath } from "./path-
|
|
3
|
-
import { S as shouldNormalizeUsingComponents, l as getProjectPlatformOptions, p as normalizePlatformNpmImportPath, v as shouldFillComponentGenericsDefault, x as shouldNormalizePlatformNpmImportPath } from "./platform-
|
|
4
|
-
import { o as changeFileExtension } from "./file-
|
|
5
|
-
import { i as scriptExtensions, s as vueExtensions } from "./constants-
|
|
1
|
+
import { n as normalizeFsResolvedId, t as isSkippableResolvedId } from "./resolvedId-DaxPh_yV.mjs";
|
|
2
|
+
import { i as normalizeRoot, s as toPosixPath } from "./path-E1OjBJAl.mjs";
|
|
3
|
+
import { S as shouldNormalizeUsingComponents, l as getProjectPlatformOptions, p as normalizePlatformNpmImportPath, v as shouldFillComponentGenericsDefault, x as shouldNormalizePlatformNpmImportPath } from "./platform-BiMpsZIb.mjs";
|
|
4
|
+
import { o as changeFileExtension } from "./file-D8mp5GmB.mjs";
|
|
5
|
+
import { i as scriptExtensions, s as vueExtensions } from "./constants-BOe8mgqL.mjs";
|
|
6
6
|
import "./logger-DGn5iEVN.mjs";
|
|
7
|
-
import { n as loadHostRolldownBuild } from "./engine-
|
|
7
|
+
import { n as loadHostRolldownBuild } from "./engine-Mnnm_ALP.mjs";
|
|
8
8
|
import { createRequire } from "node:module";
|
|
9
9
|
import process from "node:process";
|
|
10
10
|
import path from "pathe";
|
|
@@ -22,7 +22,7 @@ import { loadConfigFromFile } from "vite";
|
|
|
22
22
|
import "semver/functions/gte.js";
|
|
23
23
|
import "semver/functions/satisfies.js";
|
|
24
24
|
import "semver/functions/valid.js";
|
|
25
|
-
|
|
25
|
+
// src/utils/npmImport.ts
|
|
26
26
|
const WINDOWS_PATH_SEPARATORS_RE = /\\/g;
|
|
27
27
|
const WINDOWS_ABSOLUTE_PATH_RE = /^[a-z]:[\\/]/i;
|
|
28
28
|
const NPM_PROTOCOL_RE = /^npm:/;
|
|
@@ -149,8 +149,7 @@ function normalizeNpmImportPathByPlatform(importee, options) {
|
|
|
149
149
|
const normalized = trimmed.replace(NPM_PROTOCOL_RE, "");
|
|
150
150
|
return normalizePlatformNpmImportPath(options.platform, normalized, { alipayNpmMode: options.alipayNpmMode });
|
|
151
151
|
}
|
|
152
|
-
|
|
153
|
-
//#region src/utils/json.ts
|
|
152
|
+
// src/utils/json.ts
|
|
154
153
|
const ALIPAY_GENERIC_COMPONENT_PLACEHOLDER = "./__weapp_vite_generic_component";
|
|
155
154
|
const WEAPP_SCOPED_SLOT_GENERIC_COMPONENT_PLACEHOLDER = "./__weapp_vite_scoped_slot_generic_component";
|
|
156
155
|
const JSON_FILE_JS_EXTENSION_RE = /\.[jt]s$/;
|
|
@@ -292,8 +291,7 @@ function getPathExistsTtlMs(config) {
|
|
|
292
291
|
function getReadFileCheckMtime(config) {
|
|
293
292
|
return Boolean(config?.isDev);
|
|
294
293
|
}
|
|
295
|
-
|
|
296
|
-
//#region src/utils/configErrors.ts
|
|
294
|
+
// src/utils/configErrors.ts
|
|
297
295
|
const CJS_ERROR_PATTERNS = [
|
|
298
296
|
"__dirname is not defined",
|
|
299
297
|
"__filename is not defined",
|
|
@@ -331,8 +329,7 @@ function createCjsConfigLoadError(options) {
|
|
|
331
329
|
if (options.error instanceof Error) error.cause = options.error;
|
|
332
330
|
return error;
|
|
333
331
|
}
|
|
334
|
-
|
|
335
|
-
//#region src/utils/entryResolve.ts
|
|
332
|
+
// src/utils/entryResolve.ts
|
|
336
333
|
function buildCandidates(base, extensions) {
|
|
337
334
|
return extensions.map((ext) => changeFileExtension(base, ext));
|
|
338
335
|
}
|
|
@@ -373,8 +370,7 @@ async function resolveEntryPath(input, options) {
|
|
|
373
370
|
const extensions = resolveEntryExtensions(kind, isDir);
|
|
374
371
|
for (const candidate of buildCandidates(base, extensions)) if (await exists(candidate)) return candidate;
|
|
375
372
|
}
|
|
376
|
-
|
|
377
|
-
//#region src/utils/loadViteConfigFile.ts
|
|
373
|
+
// src/utils/loadViteConfigFile.ts
|
|
378
374
|
const DEFAULT_VITE_CONFIG_FILES = [
|
|
379
375
|
"vite.config.ts",
|
|
380
376
|
"vite.config.mts",
|
|
@@ -424,8 +420,7 @@ async function loadViteConfigFile(configEnv, configFile, configRoot, configFileD
|
|
|
424
420
|
const resolvedConfigLoader = configLoader ?? "bundle";
|
|
425
421
|
return withSuppressedWarningCodes(suppressedWarningCodes, () => loadConfigFromFile(configEnv, resolvedConfigFile, configRoot, logLevel, void 0, resolvedConfigLoader));
|
|
426
422
|
}
|
|
427
|
-
|
|
428
|
-
//#region src/utils/preloadScan.ts
|
|
423
|
+
// src/utils/preloadScan.ts
|
|
429
424
|
const HOST_ROUTER_METHODS = /* @__PURE__ */ new Set([
|
|
430
425
|
"navigateTo",
|
|
431
426
|
"redirectTo",
|
|
@@ -556,8 +551,7 @@ function collectTemplateTargets(source, sourcePage) {
|
|
|
556
551
|
function collectStaticRouteTargets(source, kind, sourcePage) {
|
|
557
552
|
return kind === "template" ? collectTemplateTargets(source, sourcePage) : collectScriptTargets(source, sourcePage);
|
|
558
553
|
}
|
|
559
|
-
|
|
560
|
-
//#region src/utils/preloadRule.ts
|
|
554
|
+
// src/utils/preloadRule.ts
|
|
561
555
|
const PRELOAD_RULE_GLOB_RE = /[*?[\]{}()!+@]/g;
|
|
562
556
|
function normalizePagePath(value) {
|
|
563
557
|
return normalizeRoot(value).replace(/^\/+/, "");
|
|
@@ -715,8 +709,7 @@ function suggestPreloadRules(appJson, pageSources) {
|
|
|
715
709
|
uncovered: [...uncovered]
|
|
716
710
|
};
|
|
717
711
|
}
|
|
718
|
-
|
|
719
|
-
//#region src/plugins/asset/prune.ts
|
|
712
|
+
// src/plugins/asset/prune.ts
|
|
720
713
|
/** 成功写出后仅撤销上一轮持有的文件,不清空目录,也不越过输出根内的符号链接。 */
|
|
721
714
|
async function pruneOwnedAssetFiles(outDir, fileNames) {
|
|
722
715
|
const root = path$1.resolve(outDir);
|
|
@@ -744,8 +737,7 @@ async function pruneOwnedAssetFiles(outDir, fileNames) {
|
|
|
744
737
|
if (error.code !== "ENOENT") throw error;
|
|
745
738
|
}
|
|
746
739
|
}
|
|
747
|
-
|
|
748
|
-
//#region src/utils/projectConfigOutput.ts
|
|
740
|
+
// src/utils/projectConfigOutput.ts
|
|
749
741
|
/** 平台项目目录独立发布,禁止覆盖由主编译持有的小程序目录。 */
|
|
750
742
|
async function collectProjectConfigAssets(sourceDir, outputRoot, outDir, watch) {
|
|
751
743
|
const assets = [];
|
|
@@ -803,8 +795,7 @@ async function publishProjectConfigAssets(outputRoot, assets, previous = /* @__P
|
|
|
803
795
|
}
|
|
804
796
|
return current;
|
|
805
797
|
}
|
|
806
|
-
|
|
807
|
-
//#region src/utils/projectConfig.ts
|
|
798
|
+
// src/utils/projectConfig.ts
|
|
808
799
|
async function readProjectConfigFile(filePath, required, readFile) {
|
|
809
800
|
if (!await fs$1.pathExists(filePath)) {
|
|
810
801
|
if (required) throw new Error(`找不到项目配置文件:${filePath}`);
|
|
@@ -868,8 +859,7 @@ async function syncProjectConfigToOutput(options) {
|
|
|
868
859
|
const assets = await collectProjectConfigAssets(syncDirs.sourceDir, syncDirs.outputRoot, options.outDir);
|
|
869
860
|
await publishProjectConfigAssets(syncDirs.outputRoot, assets);
|
|
870
861
|
}
|
|
871
|
-
|
|
872
|
-
//#region src/utils/reExport.ts
|
|
862
|
+
// src/utils/reExport.ts
|
|
873
863
|
function getSpecifierName(name) {
|
|
874
864
|
if (name?.type === "Identifier") return name.name;
|
|
875
865
|
if (name?.type === "StringLiteral" || name?.type === "Literal") return name.value;
|
|
@@ -951,8 +941,7 @@ async function resolveReExportedInternal(exporterFile, exportName, depth, visite
|
|
|
951
941
|
async function resolveReExportedName(exporterFile, exportName, options) {
|
|
952
942
|
return resolveReExportedInternal(exporterFile, exportName, options.maxDepth ?? 4, /* @__PURE__ */ new Map(), options);
|
|
953
943
|
}
|
|
954
|
-
|
|
955
|
-
//#region src/utils/toAbsoluteId.ts
|
|
944
|
+
// src/utils/toAbsoluteId.ts
|
|
956
945
|
function resolveAbsoluteIdBaseDir(configService, importer, options) {
|
|
957
946
|
const cleanImporter = importer ? normalizeFsResolvedId(importer) : void 0;
|
|
958
947
|
if (cleanImporter && !isSkippableResolvedId(cleanImporter) && path.isAbsolute(cleanImporter)) return path.dirname(cleanImporter);
|
|
@@ -975,8 +964,7 @@ function toAbsoluteId(id, configService, importer, options) {
|
|
|
975
964
|
const baseDir = resolveAbsoluteIdBaseDir(configService, importer, options);
|
|
976
965
|
return path.resolve(baseDir, cleanId);
|
|
977
966
|
}
|
|
978
|
-
|
|
979
|
-
//#region src/utils/usingComponentFrom.ts
|
|
967
|
+
// src/utils/usingComponentFrom.ts
|
|
980
968
|
function shouldResolveUsingComponentFrom(normalizedResolvedFile) {
|
|
981
969
|
return Boolean(normalizedResolvedFile && !isSkippableResolvedId(normalizedResolvedFile) && path.isAbsolute(normalizedResolvedFile));
|
|
982
970
|
}
|
|
@@ -989,8 +977,7 @@ function usingComponentFromResolvedFile(resolvedFile, configService) {
|
|
|
989
977
|
if (!relative || relative.startsWith("..")) return;
|
|
990
978
|
return `/${toPosixPath(relative)}`;
|
|
991
979
|
}
|
|
992
|
-
|
|
993
|
-
//#region src/utils/weappConfig.ts
|
|
980
|
+
// src/utils/weappConfig.ts
|
|
994
981
|
const WEAPP_VITE_CONFIG_CANDIDATES = [
|
|
995
982
|
"weapp-vite.config.ts",
|
|
996
983
|
"weapp-vite.config.mts",
|
|
@@ -1030,5 +1017,4 @@ async function resolveWeappConfigFile(options) {
|
|
|
1030
1017
|
}
|
|
1031
1018
|
return findWeappConfigInDirectory(root);
|
|
1032
1019
|
}
|
|
1033
|
-
//#endregion
|
|
1034
1020
|
export { resolveNpmDependencyId as $, createCjsConfigLoadError as A, WEAPP_SCOPED_SLOT_GENERIC_COMPONENT_PLACEHOLDER as B, loadViteConfigFile as C, invalidateFileCache as D, resolveEntryPath as E, getVisitorKeys as F, parseCommentJson as G, jsonFileRemoveJsExtension as H, parse$2 as I, toKebabCaseComponentName as J, resolveImportee as K, parseJsLike$1 as L, getReadFileCheckMtime as M, BABEL_TS_MODULE_PARSER_OPTIONS$1 as N, pathExists as O, generate$1 as P, parseNpmPackageSpecifier as Q, traverse$1 as R, TYPELESS_PACKAGE_JSON_WARNING_CODE as S, resolveEntryExtensions as T, matches as U, getAliasEntries as V, normalizeAppJson as W, normalizeNpmImportLookupPath as X, hasNpmDependencyPrefix as Y, normalizeNpmImportPathByPlatform as Z, applyPreloadRulesToAppJson as _, resolveReExportedName as a, resolvePreloadPackageIdentifier as b, getProjectConfigRootKeys as c, resolveProjectConfigRoot as d, resolveProjectConfigSyncDirs as f, pruneOwnedAssetFiles as g, publishProjectConfigAssets as h, toAbsoluteId as i, getPathExistsTtlMs as j, readFile$2 as k, getProjectPrivateConfig as l, collectProjectConfigAssets as m, shouldResolveUsingComponentFrom as n, getProjectConfig as o, syncProjectConfigToOutput as p, resolveJson as q, usingComponentFromResolvedFile as r, getProjectConfigFileName as s, resolveWeappConfigFile as t, getProjectPrivateConfigFileName as u, collectPreloadPages as v, createCachedEntryResolveOptions as w, suggestPreloadRules as x, findPreloadRuleKey as y, ALIPAY_GENERIC_COMPONENT_PLACEHOLDER as z };
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import "./config-
|
|
1
|
+
import "./config-BNx2BODw.mjs";
|
|
2
2
|
import { ConfigEnv, Plugin } from "vite";
|
|
3
|
-
//#region src/vite/index.d.ts
|
|
4
3
|
/** 通过顶层 weapp 配置激活标准 Vite 小程序编译。 */
|
|
5
4
|
export declare function weapp(): Plugin[];
|
|
6
5
|
declare module 'vite' {
|
|
7
6
|
function defineConfig<T extends (env: ConfigEnv) => UserConfig | Promise<UserConfig>>(config: T): T;
|
|
8
|
-
}
|
|
9
|
-
//#endregion
|
|
7
|
+
}
|
package/dist/vite.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { i as isWeappViteHost } from "./pluginHost
|
|
2
|
-
import { i as takeHostLifecycle, n as setHostRestartData, r as takeHostConfigRestartData, t as bindHostLifecycle } from "./lifecycle-
|
|
1
|
+
import { i as isWeappViteHost } from "./pluginHost-vn8Vty1J.mjs";
|
|
2
|
+
import { i as takeHostLifecycle, n as setHostRestartData, r as takeHostConfigRestartData, t as bindHostLifecycle } from "./lifecycle-CUo8PMQc.mjs";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { WEAPP_VITE_HMR_RUNTIME_SESSION_HANDOFF_KEY } from "@weapp-core/constants";
|
|
5
5
|
import path from "pathe";
|
|
6
|
-
|
|
6
|
+
// src/vite/classicFallback.ts
|
|
7
7
|
/** 停止失败的宿主时同时保留原始错误与清理错误。 */
|
|
8
8
|
async function rethrowAfterHostCleanup(error, cleanup) {
|
|
9
9
|
try {
|
|
@@ -26,8 +26,7 @@ function bindClassicFallback(server, runtime) {
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
//#region src/vite/environment.ts
|
|
29
|
+
// src/vite/environment.ts
|
|
31
30
|
/** 环境钩子捕获本轮会话,旧环境关闭不能清理重启后的新会话。 */
|
|
32
31
|
function createSessionEnvironmentPlugin(session, serve) {
|
|
33
32
|
return {
|
|
@@ -83,8 +82,7 @@ function createSessionEnvironmentPlugin(session, serve) {
|
|
|
83
82
|
}
|
|
84
83
|
};
|
|
85
84
|
}
|
|
86
|
-
|
|
87
|
-
//#region src/vite/options.ts
|
|
85
|
+
// src/vite/options.ts
|
|
88
86
|
async function resolvePlugins(options) {
|
|
89
87
|
const result = [];
|
|
90
88
|
for (const option of options ?? []) {
|
|
@@ -94,8 +92,7 @@ async function resolvePlugins(options) {
|
|
|
94
92
|
}
|
|
95
93
|
return result;
|
|
96
94
|
}
|
|
97
|
-
|
|
98
|
-
//#region src/vite/slots.ts
|
|
95
|
+
// src/vite/slots.ts
|
|
99
96
|
const descriptors = [
|
|
100
97
|
["weapp-vite:runtime-provider:web-runtime", "pre"],
|
|
101
98
|
["@weapp-vite/web", "pre"],
|
|
@@ -190,8 +187,7 @@ function createPluginSlots(apply) {
|
|
|
190
187
|
}
|
|
191
188
|
};
|
|
192
189
|
}
|
|
193
|
-
|
|
194
|
-
//#region src/vite/index.ts
|
|
190
|
+
// src/vite/index.ts
|
|
195
191
|
const PLUGIN_NAME = "weapp-vite:host";
|
|
196
192
|
const hmrRuntimeSessionKey = Symbol.for(WEAPP_VITE_HMR_RUNTIME_SESSION_HANDOFF_KEY);
|
|
197
193
|
/** 通过顶层 weapp 配置激活标准 Vite 小程序编译。 */
|
|
@@ -229,7 +225,7 @@ function weapp() {
|
|
|
229
225
|
...config,
|
|
230
226
|
plugins: serveRequested ? userPlugins : []
|
|
231
227
|
};
|
|
232
|
-
const { WeappBuildSession } = await import("./session-
|
|
228
|
+
const { WeappBuildSession } = await import("./session-COrQJYif.mjs");
|
|
233
229
|
session = new WeappBuildSession(takeHostConfigRestartData(inheritedLifecycle, hmrRuntimeSessionKey));
|
|
234
230
|
try {
|
|
235
231
|
const fallbackBeforePrepare = session.hmrRuntimeSession.fallback;
|
|
@@ -252,7 +248,7 @@ function weapp() {
|
|
|
252
248
|
return normalized;
|
|
253
249
|
}
|
|
254
250
|
if (serveRequested) {
|
|
255
|
-
const { prepareDevHostConfig } = await import("./dev-
|
|
251
|
+
const { prepareDevHostConfig } = await import("./dev-D1QSExwk.mjs");
|
|
256
252
|
if (!session.statefulController && config.experimental?.bundledDev && !session.hmrRuntimeSession.fallback) throw new Error("[weapp-vite] classic 开发模式暂不支持 experimental.bundledDev,请关闭此选项。");
|
|
257
253
|
const host = prepareDevHostConfig(session, merged, config);
|
|
258
254
|
slots.bind((await resolvePlugins(host.plugins)).filter((plugin) => !configuredPlugins.includes(plugin)));
|
|
@@ -305,5 +301,4 @@ function weapp() {
|
|
|
305
301
|
};
|
|
306
302
|
return [coordinator, ...slots.plugins];
|
|
307
303
|
}
|
|
308
|
-
//#endregion
|
|
309
304
|
export { weapp };
|
package/dist/volar.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WEVU_DEFINE_PAGE_MACRO, WEVU_ROUTER_MODULE_ID } from "@weapp-core/constants";
|
|
2
|
-
|
|
2
|
+
// src/auto-import-presets/wevu.ts
|
|
3
3
|
const wevu = {
|
|
4
4
|
wevu: [
|
|
5
5
|
"createApp",
|
|
@@ -138,5 +138,4 @@ const wevu = {
|
|
|
138
138
|
],
|
|
139
139
|
[WEVU_ROUTER_MODULE_ID]: [WEVU_DEFINE_PAGE_MACRO]
|
|
140
140
|
};
|
|
141
|
-
//#endregion
|
|
142
141
|
export { wevu as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WEVU_DEFINE_PAGE_MACRO, WEVU_ROUTER_MODULE_ID } from "@weapp-core/constants";
|
|
2
|
-
|
|
2
|
+
// src/auto-import-presets/wevu-router.ts
|
|
3
3
|
const wevuRouter = { [WEVU_ROUTER_MODULE_ID]: [
|
|
4
4
|
WEVU_DEFINE_PAGE_MACRO,
|
|
5
5
|
"createRouter",
|
|
@@ -13,5 +13,4 @@ const wevuRouter = { [WEVU_ROUTER_MODULE_ID]: [
|
|
|
13
13
|
"createNavigationFailure",
|
|
14
14
|
"isNavigationFailure"
|
|
15
15
|
] };
|
|
16
|
-
//#endregion
|
|
17
16
|
export { wevuRouter as t };
|