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
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ViteDevServer } from 'vite';
|
|
2
|
+
import { type RuntimeControlMessage, type RuntimeReport } from '../../../../runtime/mini/dev/hmr-protocol.ts';
|
|
3
|
+
import type { MiniContract } from '../mini-contract.ts';
|
|
4
|
+
import type { MiniStylePlugin } from '../styles/plugins.ts';
|
|
5
|
+
import type { MiniHmrMode } from './hmr-mode.ts';
|
|
6
|
+
declare module 'vite' {
|
|
7
|
+
interface CustomEventMap {
|
|
8
|
+
'vpt:mini-hmr:control': RuntimeControlMessage;
|
|
9
|
+
'vpt:mini-hmr:report': RuntimeReport;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export type MiniDevHost = Readonly<{
|
|
13
|
+
close: () => Promise<void>;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Creates the Mini Program dev host: the adapter that owns the physical Rolldown DevEngine and selected update 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 native project and either replace complete output or deliver environment-valid patches.
|
|
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 native styles, and Rolldown's published frontier from describing different source generations.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createMiniDevHost({ server, contract, styles, hmrMode }: {
|
|
25
|
+
server: ViteDevServer;
|
|
26
|
+
contract: Pick<MiniContract, 'options' | 'styles'>;
|
|
27
|
+
styles: MiniStylePlugin;
|
|
28
|
+
hmrMode: MiniHmrMode;
|
|
29
|
+
}): Promise<MiniDevHost>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { HmrInfo } from './hmr-protocol.ts';
|
|
2
|
-
export declare const developmentAppWxssFileName = "app.wxss";
|
|
3
|
-
export declare const globalWxssFileName = "assets/global.wxss";
|
|
4
2
|
export declare const hmrInfoFileName = "hmr/info.js";
|
|
5
3
|
/**
|
|
6
4
|
* Renders immutable CommonJS metadata because App startup must initialize the runtime synchronously before any entry capsule.
|
|
@@ -14,7 +12,7 @@ export declare function renderHmrInfo(info: HmrInfo): string;
|
|
|
14
12
|
* cache after it restarts. Tying this inert comment to the build identity invalidates that cache once per complete build,
|
|
15
13
|
* while incremental style updates continue changing only the imported file and therefore preserve the App heap.
|
|
16
14
|
*/
|
|
17
|
-
export declare function
|
|
15
|
+
export declare function renderDevelopmentAppStyle(globalStyleFileName: string, buildId: string): string;
|
|
18
16
|
/**
|
|
19
17
|
* Atomically publishes one physical development file so DevTools can observe only complete generations.
|
|
20
18
|
*
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
import type { MiniHmrOptions, RuntimeModulesContract } from '../mini-contract.ts';
|
|
3
|
+
import type { PatchPublication } from './hmr-protocol.ts';
|
|
4
|
+
/** One mode-selected effect executed by the development host. */
|
|
5
|
+
export type MiniHmrAction = 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 differs between Mini Program development update implementations.
|
|
16
|
+
*
|
|
17
|
+
* Every mode selects one runtime, plugin set, entry banner, Rolldown rebuild policy, and declarative patch effects. Rebuild mode
|
|
18
|
+
* uses `always` and returns no patch effects.
|
|
19
|
+
*/
|
|
20
|
+
export type MiniHmrMode = Readonly<{
|
|
21
|
+
rebuildStrategy: 'always' | 'on-failure';
|
|
22
|
+
runtimeFile: string;
|
|
23
|
+
plugins: readonly Plugin[];
|
|
24
|
+
reset?: () => MiniHmrAction;
|
|
25
|
+
publish?: (publication: PatchPublication) => MiniHmrAction;
|
|
26
|
+
createEntryBanner: (pageFiles: ReadonlySet<string>) => (chunk: Readonly<{
|
|
27
|
+
name: string;
|
|
28
|
+
fileName: string;
|
|
29
|
+
}>) => string;
|
|
30
|
+
}>;
|
|
31
|
+
/** Resolves exactly one implementation before the Mini Program development host is created. */
|
|
32
|
+
export declare function createMiniHmrMode(options: MiniHmrOptions, modules: RuntimeModulesContract): MiniHmrMode;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BindingClientHmrUpdate } from 'rolldown/experimental';
|
|
2
2
|
/** Shared Vite WebSocket path for runtime reports and mode-specific HMR events. */
|
|
3
3
|
export declare const hmrEndpointPath = "/__vpt_hmr__";
|
|
4
|
-
export type { HmrInfo, RuntimeReport } from '../../../../runtime/
|
|
4
|
+
export type { HmrInfo, RuntimeReport } from '../../../../runtime/mini/dev/hmr-protocol.ts';
|
|
5
5
|
/** The Patch variant of Rolldown's per-client HMR update admitted into the patch journal. */
|
|
6
6
|
export type PatchUpdate = Extract<BindingClientHmrUpdate['update'], {
|
|
7
7
|
type: 'Patch';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { InputOptions, OutputOptions } from 'rolldown';
|
|
2
2
|
import { type DevEngine } from 'rolldown/experimental';
|
|
3
3
|
import type { ViteDevServer } from 'vite';
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
4
|
+
import type { MiniContract } from '../mini-contract.ts';
|
|
5
|
+
import type { MiniHmrMode } from './hmr-mode.ts';
|
|
6
6
|
type BundledDevRolldownOptions = InputOptions & {
|
|
7
7
|
experimental?: {
|
|
8
8
|
[key: string]: unknown;
|
|
@@ -17,15 +17,15 @@ export type BundledDev = {
|
|
|
17
17
|
triggerBundleRegenerationIfStale(): Promise<boolean>;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
|
-
* Installs physical
|
|
20
|
+
* Installs physical Mini Program output and runtime conventions over Vite's browser-oriented bundled-development options.
|
|
21
21
|
* Build completion deliberately remains outside this options adapter: DevEngine onOutput is the single lifecycle authority.
|
|
22
22
|
*/
|
|
23
|
-
export declare function
|
|
23
|
+
export declare function installMiniDevOptions({ bundledDev, server, contract, hmrMode }: {
|
|
24
24
|
bundledDev: BundledDev;
|
|
25
25
|
server: ViteDevServer;
|
|
26
|
-
|
|
27
|
-
hmrMode:
|
|
26
|
+
contract: Pick<MiniContract, 'options'>;
|
|
27
|
+
hmrMode: MiniHmrMode;
|
|
28
28
|
}): void;
|
|
29
|
-
/** Returns the configured output after rejecting states unsupported by the physical
|
|
29
|
+
/** Returns the configured output after rejecting states unsupported by the physical Mini Program engine. */
|
|
30
30
|
export declare function requireSingleOutput(rolldownOptions: BundledDevRolldownOptions): OutputOptions;
|
|
31
31
|
export {};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RuntimeModulesContract } from '../../../mini-contract.ts';
|
|
2
|
+
import type { MiniHmrMode } from '../../hmr-mode.ts';
|
|
2
3
|
import type { PatchUpdate } from '../../hmr-protocol.ts';
|
|
3
4
|
export declare const devtoolsPatchesFileName = "hmr/patches.js";
|
|
4
5
|
/**
|
|
5
|
-
* Collects
|
|
6
|
+
* Collects behavior that depends on native development-tool project-file compilation.
|
|
6
7
|
*
|
|
7
8
|
* Runtime entry, Page transform, entry banners, and patch delivery stay in one descriptor because they implement one protocol:
|
|
8
9
|
* DevTools observes a changed Page dependency, re-executes the Page shell, and that shell synchronously gives the cumulative
|
|
9
10
|
* native factory payload to the persistent App runtime. Mixing any one of these pieces with another mode would break that chain.
|
|
10
11
|
*/
|
|
11
|
-
export declare function createDevtoolsHmrMode():
|
|
12
|
+
export declare function createDevtoolsHmrMode(modules: RuntimeModulesContract): MiniHmrMode;
|
|
12
13
|
/** Provides a valid, inert CommonJS dependency before the host has a patch range to publish. */
|
|
13
14
|
export declare function renderInitialDevtoolsPatches(): string;
|
|
14
15
|
/**
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RuntimeModulesContract } from '../../../mini-contract.ts';
|
|
2
|
+
import type { MiniHmrMode } from '../../hmr-mode.ts';
|
|
3
|
+
/** Creates the pure interpreter adapter whose events are dispatched by the shared development host. */
|
|
4
|
+
export declare function createInterpreterHmrMode(modules: RuntimeModulesContract): MiniHmrMode;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RuntimeModulesContract } from '../../../mini-contract.ts';
|
|
2
|
+
import type { MiniHmrMode } from '../../hmr-mode.ts';
|
|
3
|
+
/** Selects complete-output replacement without installing a patch transport or native Page handoff. */
|
|
4
|
+
export declare function createRebuildHmrMode(modules: RuntimeModulesContract): MiniHmrMode;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type PluginOption } from 'vite';
|
|
2
|
+
import type { MiniContract } from '../mini-contract.ts';
|
|
3
|
+
import type { MiniStylePlugin } from '../styles/plugins.ts';
|
|
4
|
+
/** Selects the sole Vite environment that owns the physical Mini Program development project. */
|
|
5
|
+
export declare function isMiniClientEnvironment(environment: Readonly<{
|
|
6
|
+
name: string;
|
|
7
|
+
}>): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Adds the serve-only bundled-development plugin set for a Mini Program 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 createMiniDevelopmentPlugin(contract: Pick<MiniContract, 'options' | 'runtime' | 'styles'>, styles: MiniStylePlugin): PluginOption[];
|
|
16
|
+
/**
|
|
17
|
+
* Transfers development ownership of the App stylesheet from complete output to the dev host.
|
|
18
|
+
*
|
|
19
|
+
* The ordinary output hook emits the static production wrapper during every complete build. In development, the existing
|
|
20
|
+
* physical wrapper instead contains the previous complete-build marker. If the static asset remained in this bundle, the
|
|
21
|
+
* DevEngine would:
|
|
22
|
+
*
|
|
23
|
+
* 1. replace the versioned wrapper with static production bytes while JavaScript and HMR metadata are still being finalized;
|
|
24
|
+
* 2. let the native tool observe that root-style change and reload the App against the previous patch identity, or before a
|
|
25
|
+
* rebuild-mode transaction has completed;
|
|
26
|
+
* 3. let the host replace the wrapper again with the new marker, causing a second App reload.
|
|
27
|
+
*
|
|
28
|
+
* Deleting only the in-memory bundle entry avoids both premature writes. Development sets `emptyOutDir: false`, so the prior
|
|
29
|
+
* physical App stylesheet remains available while complete output is written. The host replaces it exactly once afterward.
|
|
30
|
+
* Patch modes first reset delivery and publish matching `hmr/info.js`; rebuild mode has no patch state and writes a fresh marker
|
|
31
|
+
* directly. Incremental HMR never enters this complete-output hook and changes only the imported global stylesheet; rewriting
|
|
32
|
+
* the App root would reload the heap while a JavaScript patch is awaiting acknowledgement. The serve-only plugin leaves
|
|
33
|
+
* production output unchanged.
|
|
34
|
+
*/
|
|
35
|
+
export declare function removeDevelopmentAppStyle(bundle: Record<string, unknown>, appStyleFileName: string): void;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Plugin } from 'vite';
|
|
2
2
|
/**
|
|
3
|
-
* Creates the serve-only React Refresh adaptation transforms for
|
|
3
|
+
* Creates the serve-only React Refresh adaptation transforms for a Mini Program target.
|
|
4
4
|
*
|
|
5
|
-
* @vitejs/plugin-react
|
|
5
|
+
* @vitejs/plugin-react assumes an HTML preamble and browser global scope; Mini Program hosts provide neither. Each
|
|
6
6
|
* transform owns one distinct compatibility boundary:
|
|
7
7
|
*
|
|
8
8
|
* - The refresh runtime is selected by exact ID. It rewrites only the two browser protocol globals that React Refresh evaluates
|
|
9
9
|
* and injects its renderer hook at module evaluation, replacing the missing HTML preamble.
|
|
10
10
|
* - React Reconciler is selected by exact physical ID. Its renderer injection receives a static dependency on the refresh
|
|
11
11
|
* runtime, so hook installation cannot race renderer initialization during cold startup.
|
|
12
|
-
* - React-family modules are selected by the reserved free DevTools-hook identifier. Their expression references
|
|
13
|
-
*
|
|
12
|
+
* - React-family modules are selected by the reserved free DevTools-hook identifier. Their expression references are rewritten
|
|
13
|
+
* as explicit `globalThis` members; an AST visitor edits only those identifier ranges after the filter admits the module.
|
|
14
14
|
* - Refresh boundaries are selected by Vite's generated `$RefreshReg$` guard. The AST transform removes only that web-preamble
|
|
15
15
|
* assertion because each boundary already owns local wrappers over the imported refresh runtime.
|
|
16
16
|
*
|
|
17
17
|
* These adaptations deliberately remain serve-only plugin transforms rather than target-wide `define` entries. That scope
|
|
18
|
-
* prevents development protocol behavior from leaking into production or unrelated
|
|
18
|
+
* prevents development protocol behavior from leaking into production or unrelated Mini Program modules. Plugin order also
|
|
19
19
|
* matters: Reconciler receives its static refresh dependency before the later DevTools-hook transform lowers its free references.
|
|
20
20
|
*/
|
|
21
|
-
export declare function
|
|
21
|
+
export declare function createMiniReactRefreshTransforms(): Plugin[];
|
|
22
22
|
/** Makes renderer hook injection statically depend on the refresh runtime. */
|
|
23
23
|
export declare function injectReactRefreshRendererDependency(code: string): {
|
|
24
24
|
code: string;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Rolldown } from 'vite';
|
|
2
|
+
import type { VptJsonObject, VptOptions } from '../../../options.ts';
|
|
3
|
+
/** Taro compiler bindings selected by one Mini Program target. */
|
|
4
|
+
export type TaroContract = {
|
|
5
|
+
env: string;
|
|
6
|
+
componentsReactPath: string;
|
|
7
|
+
platformRuntimePath: string;
|
|
8
|
+
};
|
|
9
|
+
/** Physical runtime modules selected by one Mini Program target. */
|
|
10
|
+
export type RuntimeModulesContract = {
|
|
11
|
+
bootstrap: string;
|
|
12
|
+
transport: string;
|
|
13
|
+
appShell: string;
|
|
14
|
+
appCapsule: string;
|
|
15
|
+
componentShell: string;
|
|
16
|
+
componentCapsule: string;
|
|
17
|
+
customWrapperShell: string;
|
|
18
|
+
pageShell: string;
|
|
19
|
+
pageCapsule: string;
|
|
20
|
+
devtoolsHmrRuntime: string;
|
|
21
|
+
interpreterHmrRuntime: string;
|
|
22
|
+
};
|
|
23
|
+
/** Physical runtime selection for one Mini Program target. */
|
|
24
|
+
export type RuntimeContract = {
|
|
25
|
+
modules: RuntimeModulesContract;
|
|
26
|
+
};
|
|
27
|
+
/** Style output names selected by one Mini Program target. */
|
|
28
|
+
export type StyleContract = {
|
|
29
|
+
appFileName: string;
|
|
30
|
+
globalFileName: string;
|
|
31
|
+
};
|
|
32
|
+
/** Native component registration discovered from the final Mini Program graph. */
|
|
33
|
+
export type MiniNativeComponentRegistration = Readonly<{
|
|
34
|
+
name: string;
|
|
35
|
+
componentPath: string;
|
|
36
|
+
fields: readonly string[];
|
|
37
|
+
}>;
|
|
38
|
+
/** Graph-retained generated code package awaiting target-specific declaration. */
|
|
39
|
+
export type MiniGeneratedSubpackage = Readonly<{
|
|
40
|
+
root: string;
|
|
41
|
+
}>;
|
|
42
|
+
/** Complete final-graph input supplied to one target's project-skeleton generator. */
|
|
43
|
+
export type MiniProjectSkeletonInput = Readonly<{
|
|
44
|
+
bundle: Rolldown.OutputBundle;
|
|
45
|
+
subpackages: readonly MiniGeneratedSubpackage[];
|
|
46
|
+
nativeComponents: readonly MiniNativeComponentRegistration[];
|
|
47
|
+
isProduction: boolean;
|
|
48
|
+
}>;
|
|
49
|
+
/** One target-owned native project-skeleton generator. */
|
|
50
|
+
export type OutputContract = {
|
|
51
|
+
generateProjectSkeleton(input: MiniProjectSkeletonInput): Rolldown.EmittedAsset[];
|
|
52
|
+
};
|
|
53
|
+
/** Complete input consumed by the shared Mini Program pipeline. */
|
|
54
|
+
export type MiniContract = {
|
|
55
|
+
options: VptOptions;
|
|
56
|
+
taro: TaroContract;
|
|
57
|
+
runtime: RuntimeContract;
|
|
58
|
+
styles: StyleContract;
|
|
59
|
+
output: OutputContract;
|
|
60
|
+
};
|
|
61
|
+
/** Application JSON represented by the current Mini Program contract. */
|
|
62
|
+
export type MiniJsonObject = VptJsonObject;
|
|
63
|
+
/** One Page represented by the current Mini Program contract. */
|
|
64
|
+
export type MiniPage = MiniContract['options']['pages'][number];
|
|
65
|
+
/** HMR configuration represented by the current Mini Program contract. */
|
|
66
|
+
export type MiniHmrOptions = MiniContract['options']['hmr'];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Rolldown } from 'vite';
|
|
2
|
+
import type { RuntimeModulesContract } from '../mini-contract.ts';
|
|
3
|
+
/** Identifies Rolldown's generated helper module independently of its unstable output filename. */
|
|
4
|
+
export declare const rolldownRuntimeId = "\0rolldown/runtime.js";
|
|
5
|
+
/** Resolves the shared Taro facade's platform initialization side effect. */
|
|
6
|
+
export declare const taroPlatformRuntimeId = "\0vpt:taro-platform-runtime";
|
|
7
|
+
/** Redirects Vite's injected browser preload helper to the bootstrap identity loader. */
|
|
8
|
+
export declare const vitePreloadId = "\0vite/preload-helper.js";
|
|
9
|
+
/** Forces the native App shell entry to emit at the required root path. */
|
|
10
|
+
export declare const appShellFileName = "app.js";
|
|
11
|
+
/** Forces Taro's recursive native Component entry to emit at its configured root path. */
|
|
12
|
+
export declare const componentShellFileName = "comp.js";
|
|
13
|
+
/** Forces Taro's CustomWrapper native shell to emit at its configured root path. */
|
|
14
|
+
export declare const customWrapperShellFileName = "custom-wrapper.js";
|
|
15
|
+
/** Resolves the configured Page component from its route-qualified capsule importer. */
|
|
16
|
+
export declare const pageComponentId = "\0vpt:page-component";
|
|
17
|
+
/** Gives every Page shell one private capsule target that can be resolved using its route. */
|
|
18
|
+
export declare const pageCapsuleId = "\0vpt:page-capsule";
|
|
19
|
+
export type MiniChunk = Rolldown.PreRenderedChunk | Rolldown.RenderedChunk;
|
|
20
|
+
/** Build-graph role of an explicit native lifecycle entry. */
|
|
21
|
+
export type MiniEntryRole = 'shell' | 'capsule';
|
|
22
|
+
/** Runtime domain in which one final Mini Program JavaScript chunk executes. */
|
|
23
|
+
export type MiniExecutionKind = 'native' | 'capsule' | 'amphibious';
|
|
24
|
+
/** Complete execution classification derived from one pass over a chunk's module IDs. */
|
|
25
|
+
export type MiniChunkClassification = Readonly<{
|
|
26
|
+
entryRole: MiniEntryRole | undefined;
|
|
27
|
+
executionKind: MiniExecutionKind;
|
|
28
|
+
isTransport: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
/** Classifies final chunks against one immutable shared-runtime module table. */
|
|
31
|
+
export type MiniModuleClassifier = (chunk: MiniChunk) => MiniChunkClassification;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a classifier whose fixed identity sets are shared by every chunk in one plugin instance.
|
|
34
|
+
*
|
|
35
|
+
* Construction is O(1). Each classification normalizes every module ID exactly once and runs in O(M), where M is the number
|
|
36
|
+
* of modules in the chunk. This replaces separate shell, capsule, amphibious, and transport scans.
|
|
37
|
+
*/
|
|
38
|
+
export declare function createMiniModuleClassifier(modules: RuntimeModulesContract): MiniModuleClassifier;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Rolldown } from 'vite';
|
|
2
|
-
import type {
|
|
2
|
+
import type { MiniContract } from '../mini-contract.ts';
|
|
3
3
|
import type { GeneratedSubpackage, PackageLocation } from '../placer/placement.ts';
|
|
4
|
-
/** Creates every compiler-owned
|
|
5
|
-
export declare function createOutputFiles({ bundle,
|
|
4
|
+
/** Creates every compiler-owned Mini Program file derived from the final Rolldown bundle. */
|
|
5
|
+
export declare function createOutputFiles({ bundle, contract, subpackages, isProduction, getModuleInfo, getPackageLocation }: {
|
|
6
6
|
bundle: Rolldown.OutputBundle;
|
|
7
|
-
|
|
7
|
+
contract: Pick<MiniContract, 'output' | 'styles'>;
|
|
8
8
|
subpackages: readonly GeneratedSubpackage[];
|
|
9
9
|
isProduction: boolean;
|
|
10
10
|
getModuleInfo: (moduleId: string) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rolldown } from 'vite';
|
|
2
|
-
|
|
2
|
+
import type { MiniGeneratedSubpackage } from '../mini-contract.ts';
|
|
3
3
|
/** Identifies one generated code-only subpackage by its physical output root. */
|
|
4
4
|
export type SubpackageLocation = {
|
|
5
5
|
/** Discriminates generated subpackages from main. */
|
|
@@ -11,15 +11,8 @@ export type SubpackageLocation = {
|
|
|
11
11
|
export type PackageLocation = {
|
|
12
12
|
kind: 'main';
|
|
13
13
|
} | SubpackageLocation;
|
|
14
|
-
/**
|
|
15
|
-
export type GeneratedSubpackage =
|
|
16
|
-
/** Stable native alias derived from the generated root hash. */
|
|
17
|
-
name: string;
|
|
18
|
-
/** Physical directory containing this subpackage's emitted capsules. */
|
|
19
|
-
root: string;
|
|
20
|
-
/** Marks this as a code-only subpackage with no native Page routes. */
|
|
21
|
-
pages: readonly [];
|
|
22
|
-
};
|
|
14
|
+
/** One generated code package retained by the final output graph. */
|
|
15
|
+
export type GeneratedSubpackage = MiniGeneratedSubpackage;
|
|
23
16
|
/** Immutable ownership and materialization operations for one complete final-chunk graph. */
|
|
24
17
|
export type Placement = Readonly<{
|
|
25
18
|
getPackageLocation(chunk: Rolldown.RenderedChunk | Rolldown.OutputChunk): PackageLocation;
|
|
@@ -43,8 +36,9 @@ export type Placement = Readonly<{
|
|
|
43
36
|
* Analysis costs the sum of transition static-closure traversals. Packing scans fitting bins and intersects sparse
|
|
44
37
|
* transition sets; its worst case is O(CBT), while practical graphs have few bins and sparse transition membership.
|
|
45
38
|
*/
|
|
46
|
-
export declare function createPlacement({ chunks, getAdditionalModuleBytes }: {
|
|
39
|
+
export declare function createPlacement({ chunks, planningBudgetBytes, getAdditionalModuleBytes }: {
|
|
47
40
|
chunks: Readonly<Record<string, Rolldown.RenderedChunk>>;
|
|
41
|
+
planningBudgetBytes: number;
|
|
48
42
|
getAdditionalModuleBytes(moduleId: string): number;
|
|
49
43
|
}): Placement;
|
|
50
44
|
/** Tests the plugin-owned output prefix that physically identifies every generated subpackage. */
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { type Plugin, type Rolldown } from 'vite';
|
|
2
|
+
import type { RuntimeModulesContract } from '../mini-contract.ts';
|
|
3
|
+
import { type MiniChunkClassification, type MiniModuleClassifier } from '../module/module.ts';
|
|
2
4
|
import { type GeneratedSubpackage, type PackageLocation } from './placement.ts';
|
|
3
5
|
export type { GeneratedSubpackage, Placement } from './placement.ts';
|
|
4
6
|
/** Selects the explicit React/Taro roots whose complete dependency closure forms the framework vendor chunk. */
|
|
5
|
-
export declare function
|
|
6
|
-
/** Placement services consumed by the later
|
|
7
|
-
export type
|
|
7
|
+
export declare function isMiniFrameworkVendorModule(moduleId: string): boolean;
|
|
8
|
+
/** Placement services consumed by the later Mini Program rendering and output hooks. */
|
|
9
|
+
export type MiniPlacementPlugin = Plugin & Readonly<{
|
|
10
|
+
classifyChunk(chunk: Rolldown.PreRenderedChunk | Rolldown.RenderedChunk): MiniChunkClassification;
|
|
8
11
|
getPackageLocation(chunk: Rolldown.RenderedChunk | Rolldown.OutputChunk): PackageLocation;
|
|
9
12
|
getPhysicalChunkId(chunk: Rolldown.RenderedChunk): string;
|
|
10
13
|
getLoadMode(chunk: Rolldown.RenderedChunk): 'sync' | 'async';
|
|
11
14
|
getSubpackages(): readonly GeneratedSubpackage[];
|
|
12
15
|
}>;
|
|
13
16
|
/**
|
|
14
|
-
* Rolldown options owned by
|
|
17
|
+
* Rolldown options owned by Mini Program placement. Every field enforces a distinct output invariant. The plugin returns this object
|
|
15
18
|
* from its config hook, while direct Rolldown integration tests reuse the same value to exercise the identical lifecycle.
|
|
16
19
|
*/
|
|
17
|
-
export declare
|
|
20
|
+
export declare function createPlacementRolldownOptions(classifyChunk: MiniModuleClassifier): {
|
|
18
21
|
/**
|
|
19
22
|
* Output-stage naming remains under Rolldown's ownership. These options establish physical candidates and hash
|
|
20
23
|
* participation only; LTHP mutates the resulting OutputChunk filenames later without replacing the chunks.
|
|
@@ -24,18 +27,18 @@ export declare const placementRolldownOptions: {
|
|
|
24
27
|
* React and Taro form one stable framework boundary shared by the App and every Page capsule. Keeping their complete
|
|
25
28
|
* dependency closure together prevents application edits from invalidating framework chunk identity and makes later
|
|
26
29
|
* development generations eligible to reuse the unchanged vendor. All remaining modules use Rolldown's automatic
|
|
27
|
-
* chunking; physical
|
|
30
|
+
* chunking; physical Mini Program package placement operates on those final chunks without another split strategy.
|
|
28
31
|
*/
|
|
29
32
|
codeSplitting: {
|
|
30
33
|
groups: {
|
|
31
34
|
name: string;
|
|
32
|
-
test: typeof
|
|
35
|
+
test: typeof isMiniFrameworkVendorModule;
|
|
33
36
|
priority: number;
|
|
34
37
|
includeDependenciesRecursively: boolean;
|
|
35
38
|
}[];
|
|
36
39
|
};
|
|
37
40
|
/**
|
|
38
|
-
* Native App/Page/Component shells are files addressed directly by
|
|
41
|
+
* Native App/Page/Component shells are files addressed directly by the host and must retain the exact names configured
|
|
39
42
|
* in `input`, such as `app.js` and `pages/home/index.js`. Transport is excluded even though it is CommonJS:
|
|
40
43
|
* application chunks import its content-hashed path, so it belongs with hashed runtime/capsule entries. `[hash]`
|
|
41
44
|
* remains a Rolldown placeholder here and is resolved only after renderChunk transforms finish.
|
|
@@ -61,16 +64,16 @@ export declare const placementRolldownOptions: {
|
|
|
61
64
|
preserveEntrySignatures: 'allow-extension';
|
|
62
65
|
};
|
|
63
66
|
/**
|
|
64
|
-
* Creates the
|
|
67
|
+
* Creates the Mini Program placement lifecycle owner:
|
|
65
68
|
*
|
|
66
69
|
* 1. Its config hook installs package-neutral Rolldown names and entry-signature semantics.
|
|
67
70
|
* 2. `renderStart` atomically starts a generation in `awaiting-chunks`; no stale placement remains reachable.
|
|
68
71
|
* 3. Its first pre-order `renderChunk` creates one immutable LTHP placement from the complete tree-shaken graph.
|
|
69
|
-
* 4. `vpt:
|
|
72
|
+
* 4. `vpt:mini` asks this plugin only for package ownership, physical relocation, and native loading mode.
|
|
70
73
|
* 5. Its pre-order `generateBundle` assigns each OutputChunk its package-qualified filename and publishes app.json declarations.
|
|
71
74
|
*
|
|
72
75
|
* The discriminated state is the only generation-local mutation: `idle → awaiting-chunks → planned → finalized`. Each hook
|
|
73
76
|
* performs one whole-state transition, so stale graph state, duplicate planning, and partially reset generations are
|
|
74
77
|
* unrepresentable.
|
|
75
78
|
*/
|
|
76
|
-
export declare function
|
|
79
|
+
export declare function createMiniPlacementPlugin(modules: RuntimeModulesContract): MiniPlacementPlugin;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { Rolldown } from 'vite';
|
|
2
2
|
import type { AstTransformResult } from '../../../utils/transform.ts';
|
|
3
3
|
/**
|
|
4
|
-
* Converts one final Rolldown ESM chunk into the inert registration consumed by the
|
|
4
|
+
* Converts one final Rolldown ESM chunk into the inert registration consumed by the Mini Program module runtime.
|
|
5
5
|
*
|
|
6
6
|
* Why this boundary exists:
|
|
7
7
|
*
|
|
8
8
|
* - Rolldown produces an ESM chunk graph, but a Mini Program loads emitted JavaScript through native `require` and
|
|
9
9
|
* `require.async`; it does not provide the browser ESM loader that normally links Vite chunks.
|
|
10
|
-
* - Native App, Page, and Component shells must start through
|
|
10
|
+
* - Native App, Page, and Component shells must start through the host's synchronous lifecycle APIs, while their application
|
|
11
11
|
* graph still needs ESM linking semantics such as cycles, live exports, dynamic imports, `import.meta`, and top-level await.
|
|
12
12
|
* - The plugin therefore keeps native lifecycle shells as CommonJS and executes application "capsules" through the bundled
|
|
13
|
-
* SystemJS runtime. Native shells enter that graph
|
|
13
|
+
* SystemJS runtime. Native shells enter that graph through the language-global `System.importSync`, and asynchronous boundaries use
|
|
14
14
|
* the same runtime through `System.import`.
|
|
15
15
|
*
|
|
16
16
|
* What this renderer emits:
|
|
@@ -25,12 +25,12 @@ import type { AstTransformResult } from '../../../utils/transform.ts';
|
|
|
25
25
|
*
|
|
26
26
|
* Rolldown imports name physical output files whose relative paths include placement directories and content hashes. The
|
|
27
27
|
* SystemJS registry instead uses package-neutral logical chunk IDs. Canonicalizing both static and literal dynamic references
|
|
28
|
-
* here lets transport independently map a stable module identity to the physical `require` path selected by
|
|
28
|
+
* here lets transport independently map a stable module identity to the physical `require` path selected by Mini Program placement.
|
|
29
29
|
* Runtime-computed dynamic IDs cannot be canonicalized and are intentionally preserved.
|
|
30
30
|
*
|
|
31
31
|
* This function runs on final Rolldown output rather than arbitrary source modules. `transformSystemJs` accepts only the
|
|
32
32
|
* normalized final-chunk grammar required by this pipeline and fails the build on unsupported forms instead of risking a
|
|
33
|
-
* partial or semantically incorrect capsule. Source maps remain optional because
|
|
33
|
+
* partial or semantically incorrect capsule. Source maps remain optional because Mini Program development output deliberately disables
|
|
34
34
|
* them on this startup-critical path.
|
|
35
35
|
*/
|
|
36
36
|
export declare function renderCapsule(code: string, chunk: Rolldown.RenderedChunk, sourcemap: boolean): AstTransformResult;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { Rolldown } from 'vite';
|
|
2
2
|
import type { AstTransformResult } from '../../../utils/transform.ts';
|
|
3
|
+
import type { MiniModuleClassifier } from '../module/module.ts';
|
|
3
4
|
/**
|
|
4
|
-
* Materializes one final native/amphibious Rolldown chunk as executable
|
|
5
|
+
* Materializes one final native/amphibious Rolldown chunk as executable Mini Program CommonJS.
|
|
5
6
|
*
|
|
6
7
|
* The transform performs four semantic operations:
|
|
7
8
|
*
|
|
8
9
|
* 1. Static ESM imports are hoisted into source-order `require` calls. Named imports remain property reads from the required
|
|
9
10
|
* namespace so they observe current values. Default and namespace imports receive Babel-compatible CommonJS interop.
|
|
10
11
|
* 2. An import whose target owns a capsule entry is not passed to native `require`. It becomes
|
|
11
|
-
* `
|
|
12
|
+
* the language-global `System.importSync(logicalChunkId)`, synchronously linking the capsule before the native lifecycle call.
|
|
12
13
|
* 3. Local exports are published at declaration and mutation points. Imported re-exports use getters, while assignments and
|
|
13
14
|
* updates notify every alias without changing expression completion values or accidentally matching shadowed bindings.
|
|
14
15
|
* 4. ESM top-level `this` becomes `undefined`. Direct imported calls and tags are explicitly unbound so converting an import
|
|
@@ -16,12 +17,13 @@ import type { AstTransformResult } from '../../../utils/transform.ts';
|
|
|
16
17
|
*
|
|
17
18
|
* Static dependency loading is emitted before the untouched module body because ESM evaluates dependencies before body
|
|
18
19
|
* statements regardless of where import declarations appear textually. Generated helper names are allocated against every
|
|
19
|
-
* source identifier. Source maps use the same range edits when requested;
|
|
20
|
+
* source identifier. Source maps use the same range edits when requested; Mini Program development disables them and keeps this path
|
|
20
21
|
* focused on startup latency.
|
|
21
22
|
*/
|
|
22
|
-
export declare function renderNative({ code, chunk, chunks, sourcemap }: {
|
|
23
|
+
export declare function renderNative({ code, chunk, chunks, classifyModule, sourcemap }: {
|
|
23
24
|
code: string;
|
|
24
25
|
chunk: Rolldown.RenderedChunk;
|
|
25
26
|
chunks: Readonly<Record<string, Rolldown.RenderedChunk>>;
|
|
27
|
+
classifyModule: MiniModuleClassifier;
|
|
26
28
|
sourcemap: boolean;
|
|
27
29
|
}): AstTransformResult;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Records non-overlapping range edits and renders them in one source-order pass.
|
|
3
3
|
*
|
|
4
|
-
* Final
|
|
4
|
+
* Final Mini Program development chunks do not request source maps. RolldownMagicString's repeated relocation of hoisted
|
|
5
5
|
* functions is considerably more expensive than the semantic analysis itself, so this editor keeps the same range operations
|
|
6
6
|
* while avoiding a mutable chunk graph when no mappings can be observed.
|
|
7
7
|
*/
|
|
@@ -7,7 +7,7 @@ export type TransformSystemJsOptions = Readonly<{
|
|
|
7
7
|
filename: string;
|
|
8
8
|
format: SystemJsOutputFormat;
|
|
9
9
|
sourcemap: boolean;
|
|
10
|
-
/** Converts physical Rolldown references into the logical IDs used by the
|
|
10
|
+
/** Converts physical Rolldown references into the logical IDs used by the Mini capsule registry. */
|
|
11
11
|
resolveReference(reference: string, kind: SystemJsReferenceKind): string;
|
|
12
12
|
}>;
|
|
13
13
|
export type TransformSystemJsResult = Readonly<{
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Rolldown } from 'vite';
|
|
2
2
|
import { type AstTransformResult } from '../../../utils/transform.ts';
|
|
3
|
+
import type { MiniModuleClassifier } from '../module/module.ts';
|
|
3
4
|
/**
|
|
4
5
|
* Materializes transport while Rolldown's preliminary hash placeholders are still active. Each switch case deliberately has
|
|
5
6
|
* two IDs: the package-neutral preliminary filename without its `assets/` directory becomes the SystemJS registration
|
|
@@ -11,10 +12,11 @@ import { type AstTransformResult } from '../../../utils/transform.ts';
|
|
|
11
12
|
* chunks that import bootstrap. A Mini Program ships one application package rather than independently cached HTTP
|
|
12
13
|
* chunks, so honest content hashes and automatic graph linking are more valuable than minimizing that hash fan-out.
|
|
13
14
|
*/
|
|
14
|
-
export declare function materializeTransport({ code, transportChunk, chunks, getLoadMode, getPhysicalChunkId, sourcemap }: {
|
|
15
|
+
export declare function materializeTransport({ code, transportChunk, chunks, classifyModule, getLoadMode, getPhysicalChunkId, sourcemap }: {
|
|
15
16
|
code: string;
|
|
16
17
|
transportChunk: Rolldown.RenderedChunk;
|
|
17
18
|
chunks: Readonly<Record<string, Rolldown.RenderedChunk>>;
|
|
19
|
+
classifyModule: MiniModuleClassifier;
|
|
18
20
|
getLoadMode(chunk: Rolldown.RenderedChunk): 'sync' | 'async';
|
|
19
21
|
getPhysicalChunkId?: (chunk: Rolldown.RenderedChunk) => string;
|
|
20
22
|
sourcemap?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
/** Creates the resolver and source specializer for
|
|
3
|
-
export declare function createResolver(
|
|
1
|
+
import type { MiniContract } from '../mini-contract.ts';
|
|
2
|
+
/** Creates the resolver and source specializer for one Mini Program module graph. */
|
|
3
|
+
export declare function createResolver(contract: Pick<MiniContract, 'options' | 'runtime' | 'taro'>): {
|
|
4
4
|
resolveId(id: string, importer: string | undefined, projectRoot: string): string | undefined;
|
|
5
5
|
specialize(code: string, id: string, sourcemap?: boolean): Promise<import("../../../utils/transform.ts").AstTransformResult> | undefined;
|
|
6
6
|
applicationEntryIds: string[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { VptJsonObject } from '../../../../options.ts';
|
|
2
1
|
import { type AstTransformResult } from '../../../utils/transform.ts';
|
|
2
|
+
import type { MiniJsonObject } from '../mini-contract.ts';
|
|
3
3
|
/** Specializes the App capsule with its normalized native configuration. */
|
|
4
4
|
export declare function specializeAppCapsule({ code, id, appConfig, sourcemap }: {
|
|
5
5
|
code: string;
|
|
6
6
|
id: string;
|
|
7
|
-
appConfig:
|
|
7
|
+
appConfig: MiniJsonObject;
|
|
8
8
|
sourcemap?: boolean;
|
|
9
9
|
}): Promise<AstTransformResult>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { VptPageOption } from '../../../../options.ts';
|
|
2
1
|
import { type AstTransformResult } from '../../../utils/transform.ts';
|
|
2
|
+
import type { MiniPage } from '../mini-contract.ts';
|
|
3
3
|
/** Specializes the Page capsule for one configured route. */
|
|
4
4
|
export declare function specializePageCapsule({ code, id, page, sourcemap }: {
|
|
5
5
|
code: string;
|
|
6
6
|
id: string;
|
|
7
|
-
page:
|
|
7
|
+
page: MiniPage;
|
|
8
8
|
sourcemap?: boolean;
|
|
9
9
|
}): Promise<AstTransformResult>;
|