vite-plugin-taro 0.6.20 → 0.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.en.md +4 -4
- package/README.md +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +147 -136
- package/dist/node/plugins/mini/dev/dev-host.d.ts +29 -0
- package/dist/node/plugins/{wx → mini}/dev/hmr-files.d.ts +1 -3
- package/dist/node/plugins/mini/dev/hmr-mode.d.ts +32 -0
- package/dist/node/plugins/{wx → mini}/dev/hmr-protocol.d.ts +1 -1
- package/dist/node/plugins/{wx/dev/wx-dev-options.d.ts → mini/dev/mini-dev-options.d.ts} +7 -7
- package/dist/node/plugins/{wx → mini}/dev/modes/devtools/devtools-hmr-mode.d.ts +4 -3
- package/dist/node/plugins/mini/dev/modes/interpreter/interpreter-hmr-mode.d.ts +4 -0
- package/dist/node/plugins/mini/dev/modes/rebuild/rebuild-hmr-mode.d.ts +4 -0
- package/dist/node/plugins/mini/dev/plugins.d.ts +35 -0
- package/dist/node/plugins/{wx → mini}/dev/react-refresh.d.ts +7 -7
- package/dist/node/plugins/mini/mini-contract.d.ts +66 -0
- package/dist/node/plugins/mini/module/module.d.ts +38 -0
- package/dist/node/plugins/{wx → mini}/output/files.d.ts +4 -4
- package/dist/node/plugins/{wx → mini}/placer/placement.d.ts +5 -11
- package/dist/node/plugins/{wx → mini}/placer/placer.d.ts +14 -11
- package/dist/node/plugins/mini/plugins.d.ts +4 -0
- package/dist/node/plugins/{wx → mini}/render/capsule.d.ts +5 -5
- package/dist/node/plugins/{wx → mini}/render/native.d.ts +6 -4
- package/dist/node/plugins/{wx → mini}/render/system-js/string-editor.d.ts +1 -1
- package/dist/node/plugins/{wx → mini}/render/system-js/system-js.d.ts +1 -1
- package/dist/node/plugins/{wx → mini}/render/transport.d.ts +3 -1
- package/dist/node/plugins/{wx → mini}/resolve/resolver.d.ts +3 -3
- package/dist/node/plugins/{wx → mini}/resolve/specialize-app-capsule.d.ts +2 -2
- package/dist/node/plugins/{wx → mini}/resolve/specialize-page-capsule.d.ts +2 -2
- package/dist/node/plugins/mini/skeleton/skeleton-utils.d.ts +33 -0
- package/dist/node/plugins/{wx/styles/create-wx-transformer.d.ts → mini/styles/create-mini-transformer.d.ts} +3 -3
- package/dist/node/plugins/{wx → mini}/styles/plugins.d.ts +32 -32
- package/dist/node/plugins/wx/create-wx-skeleton.d.ts +57 -0
- package/dist/node/plugins/wx/plugins.d.ts +5 -2
- package/dist/node/plugins/zfb/create-zfb-skeleton.d.ts +59 -0
- package/dist/node/plugins/zfb/plugins.d.ts +7 -0
- package/dist/node/utils/modules.d.ts +2 -0
- package/dist/node/utils/project-config.d.ts +3 -1
- package/dist/options.d.ts +44 -26
- package/dist/runtime/{wx → mini}/amphibious/bootstrap.js +4 -4
- package/dist/runtime/{wx → mini}/capsule/app.js +1 -1
- package/dist/runtime/mini/capsule/page.js +18 -0
- package/dist/runtime/{wx → mini}/capsule/taro-runtime.d.ts +2 -2
- package/dist/runtime/{wx → mini}/capsule/taro-runtime.js +5 -4
- package/dist/runtime/{wx/dev/wx-hmr-protocol.d.ts → mini/dev/hmr-protocol.d.ts} +2 -2
- package/dist/runtime/{wx/dev/wx-hmr-protocol.js → mini/dev/hmr-protocol.js} +2 -2
- package/dist/runtime/{wx/dev/wx-hmr-runtime.d.ts → mini/dev/mini-hmr-runtime.d.ts} +24 -7
- package/dist/runtime/{wx/dev/wx-hmr-runtime.js → mini/dev/mini-hmr-runtime.js} +21 -13
- package/dist/runtime/mini/dev/modes/devtools/devtools-runtime.d.ts +23 -0
- package/dist/runtime/{wx → mini}/dev/modes/devtools/devtools-runtime.js +8 -8
- package/dist/runtime/{wx → mini}/dev/modes/devtools/page-hmr.js +5 -5
- package/dist/runtime/{wx → mini}/dev/modes/interpreter/interpreter-protocol.d.ts +2 -2
- package/dist/runtime/mini/dev/modes/interpreter/interpreter-protocol.js +1 -0
- package/dist/runtime/mini/dev/modes/interpreter/interpreter-runtime.d.ts +12 -0
- package/dist/runtime/{wx → mini}/dev/modes/interpreter/interpreter-runtime.js +14 -7
- package/dist/runtime/mini/dev/polyfill/polyfill-queue-microtask.d.ts +14 -0
- package/dist/runtime/mini/dev/polyfill/polyfill-queue-microtask.js +18 -0
- package/dist/runtime/{wx → mini}/native/page.js +1 -1
- package/dist/runtime/{wx → mini}/systemjs/system-core.js +2 -3
- package/dist/runtime/wx/dev/connect-wx-socket.d.ts +3 -0
- package/dist/runtime/wx/dev/connect-wx-socket.js +2 -0
- package/dist/runtime/wx/dev/devtools-runtime.js +5 -0
- package/dist/runtime/wx/dev/interpreter-runtime.js +5 -0
- package/dist/runtime/zfb/dev/connect-zfb-socket.d.ts +10 -0
- package/dist/runtime/zfb/dev/connect-zfb-socket.js +18 -0
- package/dist/runtime/zfb/dev/devtools-runtime.d.ts +1 -0
- package/dist/runtime/zfb/dev/devtools-runtime.js +5 -0
- package/dist/runtime/zfb/dev/interpreter-runtime.d.ts +1 -0
- package/dist/runtime/zfb/dev/interpreter-runtime.js +5 -0
- package/package.json +10 -8
- package/dist/node/plugins/wx/dev/dev-host.d.ts +0 -29
- package/dist/node/plugins/wx/dev/hmr-mode.d.ts +0 -31
- package/dist/node/plugins/wx/dev/modes/interpreter/interpreter-hmr-mode.d.ts +0 -3
- package/dist/node/plugins/wx/dev/plugins.d.ts +0 -32
- package/dist/node/plugins/wx/module/module.d.ts +0 -51
- package/dist/node/plugins/wx/output/relative-root.d.ts +0 -2
- package/dist/node/plugins/wx/output/templates.d.ts +0 -124
- package/dist/runtime/wx/capsule/page.js +0 -18
- package/dist/runtime/wx/dev/modes/interpreter/interpreter-protocol.js +0 -1
- /package/dist/node/plugins/{wx → mini}/dev/create-hmr-results-stream.d.ts +0 -0
- /package/dist/node/plugins/{wx → mini}/dev/host-actions.d.ts +0 -0
- /package/dist/node/plugins/{wx → mini}/dev/patch-journal.d.ts +0 -0
- /package/dist/node/plugins/{wx → mini}/module/chunk-path.d.ts +0 -0
- /package/dist/node/plugins/{wx → mini}/native/compile-native-component-interface.d.ts +0 -0
- /package/dist/node/plugins/{wx → mini}/native/create-native-component-output.d.ts +0 -0
- /package/dist/node/plugins/{wx → mini}/native/native-component-assets.d.ts +0 -0
- /package/dist/node/plugins/{wx → mini}/native/native-component-interface.d.ts +0 -0
- /package/dist/runtime/{wx → mini}/amphibious/bootstrap.d.ts +0 -0
- /package/dist/runtime/{wx → mini}/amphibious/transport.d.ts +0 -0
- /package/dist/runtime/{wx → mini}/amphibious/transport.js +0 -0
- /package/dist/runtime/{wx → mini}/capsule/app.d.ts +0 -0
- /package/dist/runtime/{wx → mini}/capsule/component.d.ts +0 -0
- /package/dist/runtime/{wx → mini}/capsule/component.js +0 -0
- /package/dist/runtime/{wx → mini}/capsule/page.d.ts +0 -0
- /package/dist/runtime/{wx → mini}/dev/modes/devtools/page-hmr.d.ts +0 -0
- /package/dist/runtime/{wx → mini}/native/app.d.ts +0 -0
- /package/dist/runtime/{wx → mini}/native/app.js +0 -0
- /package/dist/runtime/{wx → mini}/native/component.d.ts +0 -0
- /package/dist/runtime/{wx → mini}/native/component.js +0 -0
- /package/dist/runtime/{wx → mini}/native/custom-wrapper.d.ts +0 -0
- /package/dist/runtime/{wx → mini}/native/custom-wrapper.js +0 -0
- /package/dist/runtime/{wx → mini}/native/page.d.ts +0 -0
- /package/dist/runtime/{wx → mini}/systemjs/system-core.d.ts +0 -0
- /package/dist/runtime/wx/dev/{modes/devtools/devtools-runtime.d.ts → devtools-runtime.d.ts} +0 -0
- /package/dist/runtime/wx/dev/{modes/interpreter/interpreter-runtime.d.ts → interpreter-runtime.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DevRuntime as RolldownDevRuntime } from 'rolldown/experimental/runtime-types';
|
|
2
|
-
import { type HmrInfo } from './
|
|
2
|
+
import { type HmrInfo } from './hmr-protocol.ts';
|
|
3
3
|
/** Lexical base class injected into the runtime chunk by Rolldown; typed via the contract. */
|
|
4
4
|
declare const DevRuntime: new (clientId: string) => RolldownDevRuntime;
|
|
5
5
|
/** Mode-independent patch metadata consumed by the shared sequence and graph reducer. */
|
|
@@ -13,7 +13,7 @@ type AcceptCallback = (moduleExports: unknown) => void;
|
|
|
13
13
|
* Per-module hot state, mirroring Rolldown's web runtime: accept is a passive registration;
|
|
14
14
|
* the propagation invokes the previous execution's callbacks with the fresh exports.
|
|
15
15
|
*/
|
|
16
|
-
declare class
|
|
16
|
+
declare class MiniHotContext {
|
|
17
17
|
readonly _internal: Readonly<{
|
|
18
18
|
updateStyle(): void;
|
|
19
19
|
removeStyle(): void;
|
|
@@ -27,15 +27,30 @@ declare class WxHotContext {
|
|
|
27
27
|
/** Stable module identity and shared sparse index used only when this context accepts. */
|
|
28
28
|
private readonly moduleId;
|
|
29
29
|
private readonly acceptingContexts;
|
|
30
|
-
constructor(moduleId: string, acceptingContexts: Map<string,
|
|
30
|
+
constructor(moduleId: string, acceptingContexts: Map<string, MiniHotContext>);
|
|
31
31
|
accept(callback?: AcceptCallback): void;
|
|
32
32
|
/** Invokes this old context's callbacks; invalidation aborts the update synchronously. */
|
|
33
33
|
runAccept(moduleExports: unknown): void;
|
|
34
34
|
invalidate(reason?: string): never;
|
|
35
35
|
prune(_callback?: () => void): void;
|
|
36
36
|
}
|
|
37
|
-
/**
|
|
38
|
-
export
|
|
37
|
+
/** Task-scoped socket surface shared by the WX and Alipay Mini Program APIs. */
|
|
38
|
+
export type MiniSocketTask = Readonly<{
|
|
39
|
+
send(options: Readonly<{
|
|
40
|
+
data: string;
|
|
41
|
+
}>): void;
|
|
42
|
+
close(options: Readonly<{
|
|
43
|
+
code: number;
|
|
44
|
+
reason: string;
|
|
45
|
+
}>): void;
|
|
46
|
+
onMessage(listener: (result: Readonly<{
|
|
47
|
+
data: unknown;
|
|
48
|
+
}>) => void): void;
|
|
49
|
+
}>;
|
|
50
|
+
/** Connects one App-level HMR socket using the active platform API. */
|
|
51
|
+
export type ConnectMiniSocket = (endpoint: string) => MiniSocketTask;
|
|
52
|
+
/** Shared Mini Program host mechanics extending the Rolldown contract instead of reimplementing it. */
|
|
53
|
+
export declare class MiniHmrRuntime extends DevRuntime {
|
|
39
54
|
/**
|
|
40
55
|
* One session for this App heap. Undefined only before the mode-selected entry initializes the runtime; its identity then
|
|
41
56
|
* stays fixed while appliedSeq records the committed frontier.
|
|
@@ -50,13 +65,15 @@ export declare class WxHmrRuntime extends DevRuntime {
|
|
|
50
65
|
* the new one. Passive contexts are never retained, so space is O(number of boundaries).
|
|
51
66
|
*/
|
|
52
67
|
private readonly moduleHotContexts;
|
|
53
|
-
constructor
|
|
68
|
+
/** Immutable platform socket constructor retained for the App heap's first initialization. */
|
|
69
|
+
private readonly connectSocket;
|
|
70
|
+
constructor(connectSocket: ConnectMiniSocket);
|
|
54
71
|
/**
|
|
55
72
|
* Generated code always calls this before registerModule and reads `_internal` from the
|
|
56
73
|
* return value. Each execution immediately retires its previous accepting boundary;
|
|
57
74
|
* calling accept registers the new context after the apply plan captured old callbacks.
|
|
58
75
|
*/
|
|
59
|
-
createModuleHotContext(moduleId: string):
|
|
76
|
+
createModuleHotContext(moduleId: string): MiniHotContext;
|
|
60
77
|
/** Computes accepting boundaries and every executed module that must be re-armed. */
|
|
61
78
|
private computeHmrUpdate;
|
|
62
79
|
/** Walks executed importers until an accepting boundary is found. */
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Shared
|
|
2
|
+
* Shared Mini Program HMR runtime, bundled into the mode-selected entry and injected into Rolldown's generated runtime chunk.
|
|
3
3
|
* Rolldown provides the lexical `DevRuntime` base class; this file extends that registry instead of duplicating module loading.
|
|
4
4
|
*
|
|
5
5
|
* Concrete modes decide how executable registrations arrive—native project JavaScript or interpreted source—and provide only a
|
|
6
6
|
* synchronous installer. This class owns the invariant that installation, graph propagation, cache eviction, boundary execution,
|
|
7
7
|
* and ACK form one application transaction; it has no file-delivery or interpreter policy of its own.
|
|
8
8
|
*/
|
|
9
|
-
import { runtimeControlEvent, runtimeReportEvent } from './
|
|
9
|
+
import { runtimeControlEvent, runtimeReportEvent } from './hmr-protocol.js';
|
|
10
|
+
import { polyfillQueueMicrotask } from './polyfill/polyfill-queue-microtask.js';
|
|
10
11
|
/** Shared no-op CSS contract because physical rebuilds replace styles wholesale. */
|
|
11
12
|
const hotContextInternals = Object.freeze({
|
|
12
13
|
updateStyle() { },
|
|
@@ -16,7 +17,7 @@ const hotContextInternals = Object.freeze({
|
|
|
16
17
|
* Per-module hot state, mirroring Rolldown's web runtime: accept is a passive registration;
|
|
17
18
|
* the propagation invokes the previous execution's callbacks with the fresh exports.
|
|
18
19
|
*/
|
|
19
|
-
class
|
|
20
|
+
class MiniHotContext {
|
|
20
21
|
_internal = hotContextInternals;
|
|
21
22
|
/**
|
|
22
23
|
* Callbacks registered by this module execution. The array is allocated on first accept,
|
|
@@ -56,8 +57,8 @@ class WxHotContext {
|
|
|
56
57
|
// rebuild replaces styles wholesale, so it is a no-op.
|
|
57
58
|
prune(_callback) { }
|
|
58
59
|
}
|
|
59
|
-
/** Shared
|
|
60
|
-
export class
|
|
60
|
+
/** Shared Mini Program host mechanics extending the Rolldown contract instead of reimplementing it. */
|
|
61
|
+
export class MiniHmrRuntime extends DevRuntime {
|
|
61
62
|
/**
|
|
62
63
|
* One session for this App heap. Undefined only before the mode-selected entry initializes the runtime; its identity then
|
|
63
64
|
* stays fixed while appliedSeq records the committed frontier.
|
|
@@ -72,10 +73,17 @@ export class WxHmrRuntime extends DevRuntime {
|
|
|
72
73
|
* the new one. Passive contexts are never retained, so space is O(number of boundaries).
|
|
73
74
|
*/
|
|
74
75
|
moduleHotContexts = new Map();
|
|
75
|
-
constructor
|
|
76
|
+
/** Immutable platform socket constructor retained for the App heap's first initialization. */
|
|
77
|
+
connectSocket;
|
|
78
|
+
constructor(connectSocket) {
|
|
76
79
|
// The base has no messenger: the engine tracks per-client shipped payloads instead
|
|
77
|
-
// of executed module ids, so the
|
|
80
|
+
// of executed module ids, so the Mini Program host registers the client session itself.
|
|
78
81
|
super('');
|
|
82
|
+
// Rolldown schedules each generated React Refresh boundary with queueMicrotask. This shared runtime is constructed before
|
|
83
|
+
// any application factory, so installing the language-global fallback here covers every Mini target and development mode
|
|
84
|
+
// at the one common execution boundary while leaving production output untouched.
|
|
85
|
+
polyfillQueueMicrotask(globalThis);
|
|
86
|
+
this.connectSocket = connectSocket;
|
|
79
87
|
}
|
|
80
88
|
/**
|
|
81
89
|
* Generated code always calls this before registerModule and reads `_internal` from the
|
|
@@ -85,7 +93,7 @@ export class WxHmrRuntime extends DevRuntime {
|
|
|
85
93
|
createModuleHotContext(moduleId) {
|
|
86
94
|
// A new execution supersedes the old boundary before it decides whether to accept.
|
|
87
95
|
this.moduleHotContexts.delete(moduleId);
|
|
88
|
-
return new
|
|
96
|
+
return new MiniHotContext(moduleId, this.moduleHotContexts);
|
|
89
97
|
}
|
|
90
98
|
/** Computes accepting boundaries and every executed module that must be re-armed. */
|
|
91
99
|
computeHmrUpdate(changedIds) {
|
|
@@ -163,7 +171,7 @@ export class WxHmrRuntime extends DevRuntime {
|
|
|
163
171
|
if (this.session)
|
|
164
172
|
return;
|
|
165
173
|
this.session = { buildId: info.buildId, appliedSeq: 0 };
|
|
166
|
-
const socket =
|
|
174
|
+
const socket = this.connectSocket(info.endpoint);
|
|
167
175
|
this.socket = socket;
|
|
168
176
|
socket.onMessage(({ data }) => {
|
|
169
177
|
if (typeof data !== 'string')
|
|
@@ -185,7 +193,7 @@ export class WxHmrRuntime extends DevRuntime {
|
|
|
185
193
|
sendSocketEvent(event, data) {
|
|
186
194
|
const socket = this.socket;
|
|
187
195
|
if (!socket) {
|
|
188
|
-
throw new Error('
|
|
196
|
+
throw new Error('Mini Program HMR socket is not initialized');
|
|
189
197
|
}
|
|
190
198
|
socket.send({ data: JSON.stringify({ type: 'custom', event: event, data: data }) });
|
|
191
199
|
}
|
|
@@ -193,7 +201,7 @@ export class WxHmrRuntime extends DevRuntime {
|
|
|
193
201
|
stopSocket(reason) {
|
|
194
202
|
const socket = this.socket;
|
|
195
203
|
if (!socket) {
|
|
196
|
-
throw new Error('
|
|
204
|
+
throw new Error('Mini Program HMR socket is not initialized');
|
|
197
205
|
}
|
|
198
206
|
socket.close({ code: 1000, reason: reason });
|
|
199
207
|
}
|
|
@@ -277,7 +285,7 @@ export class WxHmrRuntime extends DevRuntime {
|
|
|
277
285
|
console.warn('[vpt] patch batch failed; apply stopped', error);
|
|
278
286
|
void this.sendReport({
|
|
279
287
|
kind: 'rebuild',
|
|
280
|
-
reason:
|
|
288
|
+
reason: error instanceof Error ? error.message : String(error)
|
|
281
289
|
});
|
|
282
290
|
return false;
|
|
283
291
|
}
|
|
@@ -288,7 +296,7 @@ export class WxHmrRuntime extends DevRuntime {
|
|
|
288
296
|
if (!session) {
|
|
289
297
|
// A report without initialize is a programming error; fail loudly instead of
|
|
290
298
|
// silently dropping the sync traffic.
|
|
291
|
-
throw new Error('
|
|
299
|
+
throw new Error('Mini Program dev runtime is not initialized');
|
|
292
300
|
}
|
|
293
301
|
const report = { buildId: session.buildId, ...data };
|
|
294
302
|
this.sendSocketEvent(runtimeReportEvent, report);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ConnectMiniSocket, MiniHmrRuntime, type RuntimePatch } from '../../mini-hmr-runtime.ts';
|
|
2
|
+
import { injectPageHmr as injectDevtoolsPageHmr } from './page-hmr.ts';
|
|
3
|
+
/**
|
|
4
|
+
* One physical DevTools patch. DevTools compiles `factory` as native project JavaScript; invoking it registers updated Rolldown
|
|
5
|
+
* factories but does not execute application modules, allowing the shared runtime to install a complete batch before one render.
|
|
6
|
+
*/
|
|
7
|
+
type DevtoolsPatch = RuntimePatch & {
|
|
8
|
+
readonly factory: () => void;
|
|
9
|
+
};
|
|
10
|
+
type HmrPageConfig = Parameters<typeof injectDevtoolsPageHmr>[0];
|
|
11
|
+
/** Adapts physical DevTools patch modules and Page replacement onto the shared Mini Program HMR runtime. */
|
|
12
|
+
declare class DevtoolsHmrRuntime extends MiniHmrRuntime {
|
|
13
|
+
/** Applies one Page-delivered payload before the native shell imports its route capsule. */
|
|
14
|
+
applyPatches(payload: Readonly<{
|
|
15
|
+
buildId: string;
|
|
16
|
+
patches: readonly DevtoolsPatch[];
|
|
17
|
+
}> | undefined): void;
|
|
18
|
+
/** Preserves the mounted Page connection while DevTools re-registers its static config. */
|
|
19
|
+
injectPageHmr(config: HmrPageConfig): HmrPageConfig;
|
|
20
|
+
}
|
|
21
|
+
/** Creates one platform-connected adapter for installation by a thin target runtime entry. */
|
|
22
|
+
export declare function createDevtoolsHmrRuntime(connectSocket: ConnectMiniSocket): DevtoolsHmrRuntime;
|
|
23
|
+
export {};
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* before its route capsule, while this singleton survives Page JavaScript hot reload in the App heap. That lifetime difference is
|
|
4
4
|
* what allows module and React state to survive repeated native Page registration.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { MiniHmrRuntime } from '../../mini-hmr-runtime.js';
|
|
7
7
|
import { injectPageHmr as injectDevtoolsPageHmr } from './page-hmr.js';
|
|
8
|
-
/** Adapts physical DevTools patch modules and Page replacement onto the shared
|
|
9
|
-
class DevtoolsHmrRuntime extends
|
|
8
|
+
/** Adapts physical DevTools patch modules and Page replacement onto the shared Mini Program HMR runtime. */
|
|
9
|
+
class DevtoolsHmrRuntime extends MiniHmrRuntime {
|
|
10
10
|
/** Applies one Page-delivered payload before the native shell imports its route capsule. */
|
|
11
11
|
applyPatches(payload) {
|
|
12
12
|
// The initial physical dependency exports undefined until the host has a patch range. Once present, apply synchronously:
|
|
@@ -20,11 +20,11 @@ class DevtoolsHmrRuntime extends WxHmrRuntime {
|
|
|
20
20
|
return injectDevtoolsPageHmr(config);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
/** Executes only the native registration program; graph application remains owned by `
|
|
23
|
+
/** Executes only the native registration program; graph application remains owned by `MiniHmrRuntime`. */
|
|
24
24
|
function installDevtoolsPatch(patch) {
|
|
25
25
|
patch.factory();
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
/** Creates one platform-connected adapter for installation by a thin target runtime entry. */
|
|
28
|
+
export function createDevtoolsHmrRuntime(connectSocket) {
|
|
29
|
+
return new DevtoolsHmrRuntime(connectSocket);
|
|
30
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// A symbol cannot collide with
|
|
1
|
+
// A symbol cannot collide with native or Taro string-named Page options, and it lets a later injection recover the exact
|
|
2
2
|
// config-local state without a route map or runtime-global WeakMap.
|
|
3
3
|
const pageHmrStateKey = Symbol('vpt.pageHmrState');
|
|
4
4
|
/** Calls a native lifecycle with the same Page bound to `this` and the same arguments. */
|
|
@@ -30,7 +30,7 @@ export function injectPageHmr(config) {
|
|
|
30
30
|
/*
|
|
31
31
|
* `Page(config)` reads `config.data` as the initial native view-model for this registration. The Page owns current app
|
|
32
32
|
* and ordinary Page fields, while each mounted CustomWrapper owns the current snapshot below its native boundary. Join
|
|
33
|
-
* those already-serialized snapshots before registration so
|
|
33
|
+
* those already-serialized snapshots before registration so the native host never publishes the stale initial placeholder tree.
|
|
34
34
|
* This lifecycle handoff performs no setData call and runs before React Refresh can publish another logical tree.
|
|
35
35
|
*/
|
|
36
36
|
config.data = mountedPage.data;
|
|
@@ -79,13 +79,13 @@ export function injectPageHmr(config) {
|
|
|
79
79
|
const customWrapperCacheKey = Symbol.for('customWrapperCache');
|
|
80
80
|
/**
|
|
81
81
|
* Replaces stale Page.data placeholders with each mounted CustomWrapper's current native snapshot in at most one O(n)
|
|
82
|
-
* traversal. This mutates only the registration data before
|
|
82
|
+
* traversal. This mutates only the registration data before the native host reads it; it performs no setData call and does not
|
|
83
83
|
* inspect React.
|
|
84
84
|
*/
|
|
85
85
|
function applyCustomWrapperSnapshots(data) {
|
|
86
|
-
const customWrapperCache = Reflect.get(
|
|
86
|
+
const customWrapperCache = Reflect.get(globalThis, customWrapperCacheKey);
|
|
87
87
|
if (!(customWrapperCache instanceof Map)) {
|
|
88
|
-
throw new Error('
|
|
88
|
+
throw new Error('Mini Program CustomWrapper cache is not installed on the language global.');
|
|
89
89
|
}
|
|
90
90
|
if (customWrapperCache.size === 0) {
|
|
91
91
|
return;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RuntimePatch } from '../../
|
|
2
|
-
export declare const interpreterServerEvent = "vpt:
|
|
1
|
+
import type { RuntimePatch } from '../../mini-hmr-runtime.ts';
|
|
2
|
+
export declare const interpreterServerEvent = "vpt:hmr-interpreter:source";
|
|
3
3
|
/** One Rolldown patch whose existing code field is interpreted instead of wrapped in a native factory. */
|
|
4
4
|
export type InterpreterPatch = RuntimePatch & {
|
|
5
5
|
readonly code: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const interpreterServerEvent = 'vpt:hmr-interpreter:source';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HmrInfo } from '../../hmr-protocol.ts';
|
|
2
|
+
import { type ConnectMiniSocket, MiniHmrRuntime } from '../../mini-hmr-runtime.ts';
|
|
3
|
+
/** Interprets cumulative patch source received by the shared App-level HMR socket. */
|
|
4
|
+
declare class InterpreterHmrRuntime extends MiniHmrRuntime {
|
|
5
|
+
/** One installer and Sval scope retain interpreted factory closures for this App heap. */
|
|
6
|
+
private readonly installPatch;
|
|
7
|
+
constructor(connectSocket: ConnectMiniSocket);
|
|
8
|
+
protected onSocketEvent(info: HmrInfo, event: string, data: unknown): void;
|
|
9
|
+
}
|
|
10
|
+
/** Creates one platform-connected interpreter for installation by a thin target runtime entry. */
|
|
11
|
+
export declare function createInterpreterHmrRuntime(connectSocket: ConnectMiniSocket): InterpreterHmrRuntime;
|
|
12
|
+
export {};
|
|
@@ -3,16 +3,22 @@
|
|
|
3
3
|
* registration source, Sval evaluates it, and the shared runtime owns the retained socket, graph application, and reports.
|
|
4
4
|
*/
|
|
5
5
|
import Sval from 'sval';
|
|
6
|
-
import {
|
|
6
|
+
import { MiniHmrRuntime } from '../../mini-hmr-runtime.js';
|
|
7
7
|
import { interpreterServerEvent } from './interpreter-protocol.js';
|
|
8
8
|
/** Interprets cumulative patch source received by the shared App-level HMR socket. */
|
|
9
|
-
class InterpreterHmrRuntime extends
|
|
9
|
+
class InterpreterHmrRuntime extends MiniHmrRuntime {
|
|
10
10
|
/** One installer and Sval scope retain interpreted factory closures for this App heap. */
|
|
11
11
|
installPatch;
|
|
12
|
-
constructor() {
|
|
13
|
-
super();
|
|
12
|
+
constructor(connectSocket) {
|
|
13
|
+
super(connectSocket);
|
|
14
14
|
const interpreter = new Sval();
|
|
15
15
|
interpreter.import('__rolldown_runtime__', this);
|
|
16
|
+
/*
|
|
17
|
+
* Sval snapshots its sandbox built-ins while its module evaluates, before this runtime's base constructor can install
|
|
18
|
+
* Mini polyfills. Import the resulting host function explicitly so interpreted Rolldown Refresh wrappers resolve the
|
|
19
|
+
* same queue as physical chunks; otherwise their first free `queueMicrotask` lookup aborts the patch before registration.
|
|
20
|
+
*/
|
|
21
|
+
interpreter.import('queueMicrotask', globalThis.queueMicrotask);
|
|
16
22
|
this.installPatch = (patch) => interpreter.run(patch.code);
|
|
17
23
|
}
|
|
18
24
|
onSocketEvent(info, event, data) {
|
|
@@ -24,6 +30,7 @@ class InterpreterHmrRuntime extends WxHmrRuntime {
|
|
|
24
30
|
}
|
|
25
31
|
}
|
|
26
32
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
/** Creates one platform-connected interpreter for installation by a thin target runtime entry. */
|
|
34
|
+
export function createInterpreterHmrRuntime(connectSocket) {
|
|
35
|
+
return new InterpreterHmrRuntime(connectSocket);
|
|
36
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type QueueMicrotask = (callback: () => void) => void;
|
|
2
|
+
type QueueMicrotaskGlobal = {
|
|
3
|
+
queueMicrotask?: QueueMicrotask;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Polyfills the microtask primitive required by Rolldown's development React Refresh boundaries.
|
|
7
|
+
*
|
|
8
|
+
* Mini Program AppService engines do not share a `queueMicrotask` compatibility baseline, while every supported engine provides
|
|
9
|
+
* Promise jobs. Every target adapter constructs its selected development runtime before any application factory evaluates, so
|
|
10
|
+
* defining the primitive there covers WX and ZFB in every development mode. Reusing one resolved Promise preserves FIFO ordering
|
|
11
|
+
* without rewriting generated modules, delaying registration to a timer task, or adding unused code to production builds.
|
|
12
|
+
*/
|
|
13
|
+
export declare function polyfillQueueMicrotask(runtimeGlobal: QueueMicrotaskGlobal): void;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Polyfills the microtask primitive required by Rolldown's development React Refresh boundaries.
|
|
3
|
+
*
|
|
4
|
+
* Mini Program AppService engines do not share a `queueMicrotask` compatibility baseline, while every supported engine provides
|
|
5
|
+
* Promise jobs. Every target adapter constructs its selected development runtime before any application factory evaluates, so
|
|
6
|
+
* defining the primitive there covers WX and ZFB in every development mode. Reusing one resolved Promise preserves FIFO ordering
|
|
7
|
+
* without rewriting generated modules, delaying registration to a timer task, or adding unused code to production builds.
|
|
8
|
+
*/
|
|
9
|
+
export function polyfillQueueMicrotask(runtimeGlobal) {
|
|
10
|
+
if (runtimeGlobal.queueMicrotask !== undefined)
|
|
11
|
+
return;
|
|
12
|
+
const resolvedPromise = Promise.resolve();
|
|
13
|
+
// This is the one intentional global mutation: every independently bundled development chunk must resolve the same host
|
|
14
|
+
// primitive, and assigning the real global is the only scope shared by the injected runtime and later application factories.
|
|
15
|
+
runtimeGlobal.queueMicrotask = (callback) => {
|
|
16
|
+
void resolvedPromise.then(callback);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* Core comes with no System.prototype.resolve or
|
|
15
15
|
* System.prototype.instantiate implementations
|
|
16
16
|
*/
|
|
17
|
-
var envGlobal = global;
|
|
18
17
|
var hasSymbol = typeof Symbol !== 'undefined';
|
|
19
18
|
function createMissingRegistrationError(id) {
|
|
20
19
|
return Error('Module did not instantiate: ' + id);
|
|
@@ -36,7 +35,7 @@ systemJSPrototype.import = function (id, parentId, meta) {
|
|
|
36
35
|
/**
|
|
37
36
|
* Instantiates, links, and evaluates a graph without yielding the current JavaScript turn.
|
|
38
37
|
*
|
|
39
|
-
*
|
|
38
|
+
* Mini Program placement guarantees that every registration in a synchronous graph uses the main-package transport. Encountering
|
|
40
39
|
* a thenable therefore indicates a fatal placement invariant violation. No rollback is attempted: rows already published
|
|
41
40
|
* to the shared registry remain there and the current runtime heap must not be reused.
|
|
42
41
|
*/
|
|
@@ -327,5 +326,5 @@ function postOrderExec(loader, load, seen) {
|
|
|
327
326
|
}
|
|
328
327
|
}
|
|
329
328
|
}
|
|
330
|
-
|
|
329
|
+
globalThis.System = new SystemJS();
|
|
331
330
|
// biome-ignore-end lint: vendored SystemJS core
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createDevtoolsHmrRuntime } from '../../mini/dev/modes/devtools/devtools-runtime.js';
|
|
2
|
+
import { connectWxSocket } from './connect-wx-socket.js';
|
|
3
|
+
// Rolldown reads this singleton as a free identifier, so install it on the language global. It survives Page shell
|
|
4
|
+
// re-evaluation and owns the retained module graph.
|
|
5
|
+
Reflect.set(globalThis, '__rolldown_runtime__', createDevtoolsHmrRuntime(connectWxSocket));
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createInterpreterHmrRuntime } from '../../mini/dev/modes/interpreter/interpreter-runtime.js';
|
|
2
|
+
import { connectWxSocket } from './connect-wx-socket.js';
|
|
3
|
+
// Rolldown reads this singleton as a free identifier, so install it on the language global. It retains interpreted factories,
|
|
4
|
+
// the socket, module cache, and Refresh boundaries.
|
|
5
|
+
Reflect.set(globalThis, '__rolldown_runtime__', createInterpreterHmrRuntime(connectWxSocket));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ConnectMiniSocket } from '../../mini/dev/mini-hmr-runtime.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Opens an independent Alipay socket and adapts its receive envelope to the shared Mini runtime.
|
|
4
|
+
*
|
|
5
|
+
* Alipay reports inbound text as `{ message }`, whereas WeChat and the internal socket contract use `{ data }`. Without this
|
|
6
|
+
* adapter the WebSocket frame remains visible in DevTools, but the shared listener reads `undefined`, classifies it as non-text,
|
|
7
|
+
* and returns without evaluating the interpreter patch or logging an error. Vite sends only JSON text, so no binary conversion is
|
|
8
|
+
* needed here.
|
|
9
|
+
*/
|
|
10
|
+
export declare const connectZfbSocket: ConnectMiniSocket;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opens an independent Alipay socket and adapts its receive envelope to the shared Mini runtime.
|
|
3
|
+
*
|
|
4
|
+
* Alipay reports inbound text as `{ message }`, whereas WeChat and the internal socket contract use `{ data }`. Without this
|
|
5
|
+
* adapter the WebSocket frame remains visible in DevTools, but the shared listener reads `undefined`, classifies it as non-text,
|
|
6
|
+
* and returns without evaluating the interpreter patch or logging an error. Vite sends only JSON text, so no binary conversion is
|
|
7
|
+
* needed here.
|
|
8
|
+
*/
|
|
9
|
+
export const connectZfbSocket = (endpoint) => {
|
|
10
|
+
const socket = my.connectSocket({ url: endpoint, multiple: true, protocols: ['vite-hmr'] });
|
|
11
|
+
return {
|
|
12
|
+
send: (options) => socket.send(options),
|
|
13
|
+
close: (options) => socket.close(options),
|
|
14
|
+
onMessage: (listener) => {
|
|
15
|
+
socket.onMessage(({ message }) => listener({ data: message }));
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createDevtoolsHmrRuntime } from '../../mini/dev/modes/devtools/devtools-runtime.js';
|
|
2
|
+
import { connectZfbSocket } from './connect-zfb-socket.js';
|
|
3
|
+
// Rolldown reads this singleton as a free identifier, so install it on the language global. It survives Page shell
|
|
4
|
+
// re-evaluation and owns the retained module graph.
|
|
5
|
+
Reflect.set(globalThis, '__rolldown_runtime__', createDevtoolsHmrRuntime(connectZfbSocket));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createInterpreterHmrRuntime } from '../../mini/dev/modes/interpreter/interpreter-runtime.js';
|
|
2
|
+
import { connectZfbSocket } from './connect-zfb-socket.js';
|
|
3
|
+
// Rolldown reads this singleton as a free identifier, so install it on the language global. It retains interpreted factories,
|
|
4
|
+
// the socket, module cache, and Refresh boundaries.
|
|
5
|
+
Reflect.set(globalThis, '__rolldown_runtime__', createInterpreterHmrRuntime(connectZfbSocket));
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-taro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"author": "sep2",
|
|
5
|
-
"description": "Vite 8 plugin for building one React/Taro codebase for WeChat
|
|
5
|
+
"description": "Vite 8 plugin for building one React/Taro codebase for WeChat, Alipay, and H5 targets.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"vite-plugin",
|
|
43
43
|
"taro",
|
|
44
44
|
"wechat",
|
|
45
|
+
"alipay",
|
|
45
46
|
"mini-program",
|
|
46
47
|
"react"
|
|
47
48
|
],
|
|
@@ -58,16 +59,17 @@
|
|
|
58
59
|
"@tailwindcss/vite": "4.3.3",
|
|
59
60
|
"@tarojs/components": "4.2.1",
|
|
60
61
|
"@tarojs/helper": "4.2.1",
|
|
61
|
-
"@tarojs/plugin-framework-react": "npm:vite-plugin-taro-plugin-framework-react@0.
|
|
62
|
+
"@tarojs/plugin-framework-react": "npm:vite-plugin-taro-plugin-framework-react@0.7.0",
|
|
63
|
+
"@tarojs/plugin-platform-alipay": "4.2.1",
|
|
62
64
|
"@tarojs/plugin-platform-h5": "4.2.1",
|
|
63
65
|
"@tarojs/plugin-platform-weapp": "4.2.1",
|
|
64
|
-
"@tarojs/react": "npm:vite-plugin-taro-react@0.
|
|
66
|
+
"@tarojs/react": "npm:vite-plugin-taro-react@0.7.0",
|
|
65
67
|
"@tarojs/router": "4.2.1",
|
|
66
|
-
"@tarojs/runtime": "npm:vite-plugin-taro-runtime@0.
|
|
68
|
+
"@tarojs/runtime": "npm:vite-plugin-taro-runtime@0.7.0",
|
|
67
69
|
"@tarojs/taro": "4.2.1",
|
|
68
|
-
"@vitejs/plugin-react": "^6.1.
|
|
70
|
+
"@vitejs/plugin-react": "^6.1.1",
|
|
69
71
|
"react-reconciler": "0.33.0",
|
|
70
|
-
"rolldown": "1.2.
|
|
72
|
+
"rolldown": "1.2.7",
|
|
71
73
|
"sval": "0.6.12",
|
|
72
74
|
"tailwindcss": "^4.3.3"
|
|
73
75
|
},
|
|
@@ -83,7 +85,7 @@
|
|
|
83
85
|
"@babel/plugin-transform-modules-commonjs": "^8.0.1",
|
|
84
86
|
"@babel/plugin-transform-modules-systemjs": "^8.0.1",
|
|
85
87
|
"@babel/types": "^8.0.4",
|
|
86
|
-
"@oxc-project/types": "0.
|
|
88
|
+
"@oxc-project/types": "0.148.0",
|
|
87
89
|
"@rolldown/plugin-babel": "^0.2.3",
|
|
88
90
|
"@tailwindcss-mangle/engine": "0.2.0",
|
|
89
91
|
"@types/node": "^26.3.0",
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { ViteDevServer } from 'vite';
|
|
2
|
-
import type { VptOptions } from '../../../../options.ts';
|
|
3
|
-
import { type RuntimeControlMessage, type RuntimeReport } from '../../../../runtime/wx/dev/wx-hmr-protocol.ts';
|
|
4
|
-
import type { WxStylePlugin } from '../styles/plugins.ts';
|
|
5
|
-
import type { WxHmrMode } from './hmr-mode.ts';
|
|
6
|
-
declare module 'vite' {
|
|
7
|
-
interface CustomEventMap {
|
|
8
|
-
'vpt:wx-hmr:control': RuntimeControlMessage;
|
|
9
|
-
'vpt:wx-hmr:report': RuntimeReport;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export type WxDevHost = Readonly<{
|
|
13
|
-
close: () => Promise<void>;
|
|
14
|
-
}>;
|
|
15
|
-
/**
|
|
16
|
-
* Creates the WX dev host: the adapter that owns the physical Rolldown DevEngine, shared patch journal, and selected mode effects.
|
|
17
|
-
* It replaces Vite's browser-oriented `bundledDev.listen()` because a Mini Program cannot execute Vite's browser module graph;
|
|
18
|
-
* its engine must write a complete native project while the selected mode supplies an environment-valid patch mechanism.
|
|
19
|
-
*
|
|
20
|
-
* The shared style plugin carries the resolver's immutable App/Page cascade policy while Rolldown remains authoritative for
|
|
21
|
-
* every live import edge. Keeping those responsibilities in the same serialized host transaction prevents JavaScript factories,
|
|
22
|
-
* physical WXSS, and Rolldown's published frontier from describing different source generations.
|
|
23
|
-
*/
|
|
24
|
-
export declare function createWxDevHost({ server, options, styles, hmrMode }: {
|
|
25
|
-
server: ViteDevServer;
|
|
26
|
-
options: VptOptions;
|
|
27
|
-
styles: WxStylePlugin;
|
|
28
|
-
hmrMode: WxHmrMode;
|
|
29
|
-
}): Promise<WxDevHost>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from 'vite';
|
|
2
|
-
import type { VptHmrOptions } from '../../../../options.ts';
|
|
3
|
-
import type { PatchPublication } from './hmr-protocol.ts';
|
|
4
|
-
/** One mode-selected effect executed by the development host. */
|
|
5
|
-
export type WxHmrAction = Readonly<{
|
|
6
|
-
kind: 'event';
|
|
7
|
-
event: string;
|
|
8
|
-
data: unknown;
|
|
9
|
-
}> | Readonly<{
|
|
10
|
-
kind: 'write';
|
|
11
|
-
fileName: string;
|
|
12
|
-
source: string;
|
|
13
|
-
}>;
|
|
14
|
-
/**
|
|
15
|
-
* The behavior that genuinely differs between WX HMR implementations.
|
|
16
|
-
*
|
|
17
|
-
* The descriptor is selected once during plugin composition and returns declarative effects. The shared host alone performs
|
|
18
|
-
* physical writes and event transport, so neither mode receives a Vite server or owns asynchronous infrastructure.
|
|
19
|
-
*/
|
|
20
|
-
export type WxHmrMode = Readonly<{
|
|
21
|
-
runtimeFile: string;
|
|
22
|
-
plugins: readonly Plugin[];
|
|
23
|
-
reset: () => WxHmrAction | undefined;
|
|
24
|
-
publish: (publication: PatchPublication) => WxHmrAction;
|
|
25
|
-
createEntryBanner: (pageFiles: ReadonlySet<string>) => (chunk: Readonly<{
|
|
26
|
-
name: string;
|
|
27
|
-
fileName: string;
|
|
28
|
-
}>) => string;
|
|
29
|
-
}>;
|
|
30
|
-
/** Resolves exactly one implementation before the WX development host is created. */
|
|
31
|
-
export declare function createWxHmrMode(options: VptHmrOptions | undefined): WxHmrMode;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { type PluginOption } from 'vite';
|
|
2
|
-
import type { VptOptions } from '../../../../options.ts';
|
|
3
|
-
import type { WxStylePlugin } from '../styles/plugins.ts';
|
|
4
|
-
/** Selects the sole Vite environment that owns the physical Mini Program development project. */
|
|
5
|
-
export declare function isWxClientEnvironment(environment: Readonly<{
|
|
6
|
-
name: string;
|
|
7
|
-
}>): boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Adds the serve-only bundled-development plugin set for the wx target: the shared dev adapter, selected HMR mode, and React
|
|
10
|
-
* Refresh adaptation transforms.
|
|
11
|
-
*
|
|
12
|
-
* The shared style pipeline already owns the resolver's ordered App/Page cascade policy, so the host does not reconstruct it
|
|
13
|
-
* from unrelated Rolldown shell and transport entries.
|
|
14
|
-
*/
|
|
15
|
-
export declare function createWxDevelopmentPlugin(options: VptOptions, styles: WxStylePlugin): PluginOption[];
|
|
16
|
-
/**
|
|
17
|
-
* Transfers development ownership of `app.wxss` from complete output to the dev host.
|
|
18
|
-
*
|
|
19
|
-
* The ordinary WX output hook emits the static production wrapper during every complete build. In development, the existing
|
|
20
|
-
* physical wrapper instead contains the previous build ID. If the static asset remained in this bundle, the DevEngine would:
|
|
21
|
-
*
|
|
22
|
-
* 1. replace the versioned wrapper with static production bytes while JavaScript and HMR metadata are still being finalized;
|
|
23
|
-
* 2. let DevTools observe that root-style change and reload the App against the previous build identity;
|
|
24
|
-
* 3. let the host replace the wrapper again with the new build ID, causing a second App reload.
|
|
25
|
-
*
|
|
26
|
-
* Deleting only the in-memory bundle entry avoids both premature writes. Development sets `emptyOutDir: false`, so the prior
|
|
27
|
-
* physical `app.wxss` remains available while the complete output is written. The host replaces it exactly once after the
|
|
28
|
-
* selected mode has reset and the matching `hmr/info.js` identity is durable. Incremental HMR never enters this complete-
|
|
29
|
-
* output hook and changes only `assets/global.wxss`; rewriting the App root would reload the heap while a JavaScript patch is
|
|
30
|
-
* awaiting acknowledgement. The serve-only plugin leaves production output unchanged.
|
|
31
|
-
*/
|
|
32
|
-
export declare function removeDevelopmentAppWxss(bundle: Record<string, unknown>): void;
|