@ohos-ports/rolldown 1.2.6-beta.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/LICENSE +25 -0
- package/README.md +11 -0
- package/THIRD-PARTY-LICENSE +33 -0
- package/bin/cli.mjs +11 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +1208 -0
- package/dist/config.d.mts +26 -0
- package/dist/config.mjs +4 -0
- package/dist/experimental-default-runtime.mjs +116 -0
- package/dist/experimental-index.d.mts +324 -0
- package/dist/experimental-index.mjs +383 -0
- package/dist/experimental-runtime-base.mjs +95 -0
- package/dist/experimental-runtime-types.d.ts +177 -0
- package/dist/experimental-runtime.d.ts +177 -0
- package/dist/experimental-runtime.mjs +257 -0
- package/dist/filter-index.d.mts +196 -0
- package/dist/filter-index.mjs +376 -0
- package/dist/get-log-filter.d.mts +3 -0
- package/dist/get-log-filter.mjs +68 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.mjs +56 -0
- package/dist/parallel-plugin-worker.d.mts +1 -0
- package/dist/parallel-plugin-worker.mjs +29 -0
- package/dist/parallel-plugin.d.mts +12 -0
- package/dist/parallel-plugin.mjs +6 -0
- package/dist/parse-ast-index.d.mts +30 -0
- package/dist/parse-ast-index.mjs +60 -0
- package/dist/plugins-index.d.mts +32 -0
- package/dist/plugins-index.mjs +40 -0
- package/dist/shared/binding-CtPG-2KR.mjs +675 -0
- package/dist/shared/binding-Og__jmUi.d.mts +2065 -0
- package/dist/shared/bindingify-input-options-4JJxbZl2.mjs +2416 -0
- package/dist/shared/constructors-Qrp2Xr6w.d.mts +35 -0
- package/dist/shared/constructors-ltBDfHX1.mjs +69 -0
- package/dist/shared/create-bundler-option-DSPiA5F7.mjs +3220 -0
- package/dist/shared/define-config-Demdg3_4.mjs +6 -0
- package/dist/shared/define-config-Nbz-lniw.d.mts +4101 -0
- package/dist/shared/dist-DKbukT1H.mjs +154 -0
- package/dist/shared/error-HDibX49O.mjs +85 -0
- package/dist/shared/get-log-filter-AjBknEEO.d.mts +34 -0
- package/dist/shared/load-config-BMUrE9HH.mjs +137 -0
- package/dist/shared/logging-xuHO4mAy.d.mts +50 -0
- package/dist/shared/logs-DmYCAKcW.mjs +192 -0
- package/dist/shared/misc-DOSKtd97.mjs +29 -0
- package/dist/shared/normalize-string-or-regex-DWz4it3p.mjs +68 -0
- package/dist/shared/parse-D0g29RgN.mjs +74 -0
- package/dist/shared/prompt-CH6TK0bC.mjs +885 -0
- package/dist/shared/resolve-tsconfig-CLYpUIZC.mjs +128 -0
- package/dist/shared/rolldown-C9Hfg50O.mjs +179 -0
- package/dist/shared/transform-DR4CXeQm.d.mts +152 -0
- package/dist/shared/watch-UbzgabQn.mjs +377 -0
- package/dist/utils-index.d.mts +375 -0
- package/dist/utils-index.mjs +2416 -0
- package/package.json +159 -0
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import { n as __toESM, t as require_binding } from "./shared/binding-CtPG-2KR.mjs";
|
|
2
|
+
import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./shared/normalize-string-or-regex-DWz4it3p.mjs";
|
|
3
|
+
import { u as transformToRollupOutput } from "./shared/bindingify-input-options-4JJxbZl2.mjs";
|
|
4
|
+
import { l as PluginDriver, s as validateOption, t as createBundlerOptions } from "./shared/create-bundler-option-DSPiA5F7.mjs";
|
|
5
|
+
import { i as unwrapBindingResult, r as normalizeBindingResult } from "./shared/error-HDibX49O.mjs";
|
|
6
|
+
import { n as parseSync$1, t as parse$1 } from "./shared/parse-D0g29RgN.mjs";
|
|
7
|
+
import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWebWorkerPostPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-ltBDfHX1.mjs";
|
|
8
|
+
import { a as minify$1, i as transformSync$1, n as resolveTsconfig, o as minifySync$1, r as transform$1, t as TsconfigCache$1 } from "./shared/resolve-tsconfig-CLYpUIZC.mjs";
|
|
9
|
+
import { pathToFileURL } from "node:url";
|
|
10
|
+
//#region src/api/dev/dev-engine.ts
|
|
11
|
+
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
|
|
12
|
+
/** Read-only view over the engine's module graph, kept current across rebuilds. */
|
|
13
|
+
var DevEngineModuleGraph = class {
|
|
14
|
+
#inner;
|
|
15
|
+
constructor(inner) {
|
|
16
|
+
this.#inner = inner;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get additional information about the module in question.
|
|
20
|
+
*
|
|
21
|
+
* @returns Module information for that module. `null` if the module could not be found.
|
|
22
|
+
*/
|
|
23
|
+
getModuleInfo(moduleId) {
|
|
24
|
+
return this.#inner.getModuleInfo(moduleId) ?? null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get all module ids in the current module graph.
|
|
28
|
+
*
|
|
29
|
+
* @returns An array of module ids.
|
|
30
|
+
*/
|
|
31
|
+
getModuleIds() {
|
|
32
|
+
return this.#inner.getModuleIds();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var DevEngine = class DevEngine {
|
|
36
|
+
#inner;
|
|
37
|
+
#cachedBuildFinishPromise = null;
|
|
38
|
+
#asyncRuntimeReleased = false;
|
|
39
|
+
moduleGraph;
|
|
40
|
+
static async create(inputOptions, outputOptions = {}, devOptions = {}) {
|
|
41
|
+
inputOptions = await PluginDriver.callOptionsHook(inputOptions);
|
|
42
|
+
const options = await createBundlerOptions(inputOptions, outputOptions, false);
|
|
43
|
+
const userOnHmrUpdates = devOptions.onHmrUpdates;
|
|
44
|
+
const bindingOnHmrUpdates = userOnHmrUpdates ? function(rawResult) {
|
|
45
|
+
const result = normalizeBindingResult(rawResult);
|
|
46
|
+
if (result instanceof Error) {
|
|
47
|
+
userOnHmrUpdates(result);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const [updates, changedFiles] = result;
|
|
51
|
+
userOnHmrUpdates({
|
|
52
|
+
updates,
|
|
53
|
+
changedFiles
|
|
54
|
+
});
|
|
55
|
+
} : void 0;
|
|
56
|
+
const userOnOutput = devOptions.onOutput;
|
|
57
|
+
const bindingOnOutput = userOnOutput ? function(rawResult) {
|
|
58
|
+
const result = normalizeBindingResult(rawResult);
|
|
59
|
+
if (result instanceof Error) {
|
|
60
|
+
userOnOutput(result);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
userOnOutput(transformToRollupOutput(result));
|
|
64
|
+
} : void 0;
|
|
65
|
+
const userOnAdditionalAssets = devOptions.onAdditionalAssets;
|
|
66
|
+
const bindingDevOptions = {
|
|
67
|
+
onHmrUpdates: bindingOnHmrUpdates,
|
|
68
|
+
onOutput: bindingOnOutput,
|
|
69
|
+
onAdditionalAssets: userOnAdditionalAssets ? function(output) {
|
|
70
|
+
userOnAdditionalAssets(transformToRollupOutput(output));
|
|
71
|
+
} : void 0,
|
|
72
|
+
rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? import_binding.BindingRebuildStrategy.Always : import_binding.BindingRebuildStrategy.Never : void 0,
|
|
73
|
+
watch: devOptions.watch && {
|
|
74
|
+
enabled: devOptions.watch.enabled,
|
|
75
|
+
skipWrite: devOptions.watch.skipWrite,
|
|
76
|
+
usePolling: devOptions.watch.usePolling,
|
|
77
|
+
pollInterval: devOptions.watch.pollInterval,
|
|
78
|
+
useDebounce: devOptions.watch.useDebounce,
|
|
79
|
+
debounceDuration: devOptions.watch.debounceDuration,
|
|
80
|
+
compareContentsForPolling: devOptions.watch.compareContentsForPolling,
|
|
81
|
+
debounceTickRate: devOptions.watch.debounceTickRate,
|
|
82
|
+
include: normalizedStringOrRegex(devOptions.watch.include),
|
|
83
|
+
exclude: normalizedStringOrRegex(devOptions.watch.exclude)
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const inner = new import_binding.BindingDevEngine(options.bundlerOptions, bindingDevOptions);
|
|
87
|
+
(0, import_binding.startAsyncRuntime)();
|
|
88
|
+
return new DevEngine(inner);
|
|
89
|
+
}
|
|
90
|
+
constructor(inner) {
|
|
91
|
+
this.#inner = inner;
|
|
92
|
+
this.moduleGraph = new DevEngineModuleGraph(inner);
|
|
93
|
+
}
|
|
94
|
+
async run() {
|
|
95
|
+
await this.#inner.run();
|
|
96
|
+
}
|
|
97
|
+
async ensureCurrentBuildFinish() {
|
|
98
|
+
if (this.#cachedBuildFinishPromise) return this.#cachedBuildFinishPromise;
|
|
99
|
+
const promise = this.#inner.ensureCurrentBuildFinish().then(() => {
|
|
100
|
+
this.#cachedBuildFinishPromise = null;
|
|
101
|
+
});
|
|
102
|
+
this.#cachedBuildFinishPromise = promise;
|
|
103
|
+
return promise;
|
|
104
|
+
}
|
|
105
|
+
async getBundleState() {
|
|
106
|
+
return this.#inner.getBundleState();
|
|
107
|
+
}
|
|
108
|
+
async ensureLatestBuildOutput() {
|
|
109
|
+
unwrapBindingResult(await this.#inner.ensureLatestBuildOutput());
|
|
110
|
+
}
|
|
111
|
+
triggerFullBuild() {
|
|
112
|
+
this.#inner.triggerFullBuild();
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Client-connect signal (the clientId hello): creates the per-client session
|
|
116
|
+
* with an empty ship map. Reconnects arrive as fresh clientIds.
|
|
117
|
+
*/
|
|
118
|
+
async registerClient(clientId) {
|
|
119
|
+
await this.#inner.registerClient(clientId);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Delivery notification from the serving middleware: the response for
|
|
123
|
+
* `filename` completed, so record its modules as shipped to that client.
|
|
124
|
+
*/
|
|
125
|
+
async notifyPayloadDelivered(filename) {
|
|
126
|
+
await this.#inner.notifyPayloadDelivered(filename);
|
|
127
|
+
}
|
|
128
|
+
async removeClient(clientId) {
|
|
129
|
+
await this.#inner.removeClient(clientId);
|
|
130
|
+
}
|
|
131
|
+
async close() {
|
|
132
|
+
const shouldRelease = !this.#asyncRuntimeReleased;
|
|
133
|
+
this.#asyncRuntimeReleased = true;
|
|
134
|
+
try {
|
|
135
|
+
await this.#inner.close();
|
|
136
|
+
} finally {
|
|
137
|
+
if (shouldRelease) (0, import_binding.shutdownAsyncRuntime)();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Compile a lazy entry module and return HMR-style patch code.
|
|
142
|
+
*
|
|
143
|
+
* This is called when a dynamically imported module is first requested at runtime.
|
|
144
|
+
* The module was previously stubbed with a proxy, and now we need to compile the
|
|
145
|
+
* actual module and its dependencies.
|
|
146
|
+
*
|
|
147
|
+
* @param moduleId - The absolute file path of the module to compile
|
|
148
|
+
* @param clientId - The client ID requesting this compilation
|
|
149
|
+
* @returns The compiled chunk: its code plus the filename whose delivery the
|
|
150
|
+
* serving middleware reports via {@link notifyPayloadDelivered}
|
|
151
|
+
*/
|
|
152
|
+
async compileEntry(moduleId, clientId) {
|
|
153
|
+
return this.#inner.compileEntry(moduleId, clientId);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region src/api/dev/index.ts
|
|
158
|
+
const dev = (...args) => DevEngine.create(...args);
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/types/external-memory-handle.ts
|
|
161
|
+
const symbolForExternalMemoryHandle = "__rolldown_external_memory_handle__";
|
|
162
|
+
/**
|
|
163
|
+
* Frees the external memory held by the given handle.
|
|
164
|
+
*
|
|
165
|
+
* This is useful when you want to manually release memory held by Rust objects
|
|
166
|
+
* (like `OutputChunk` or `OutputAsset`) before they are garbage collected.
|
|
167
|
+
*
|
|
168
|
+
* @param handle - The object with external memory to free
|
|
169
|
+
* @param keepDataAlive - If true, evaluates all lazy fields before freeing memory (default: false).
|
|
170
|
+
* This will take time to copy data from Rust to JavaScript, but prevents errors
|
|
171
|
+
* when accessing properties after the memory is freed.
|
|
172
|
+
* @returns Status object with `freed` boolean and optional `reason` string.
|
|
173
|
+
* - `{ freed: true }` if memory was successfully freed
|
|
174
|
+
* - `{ freed: false, reason: "..." }` if memory couldn't be freed (e.g., already freed or other references exist)
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```typescript
|
|
178
|
+
* import { freeExternalMemory } from 'rolldown/experimental';
|
|
179
|
+
*
|
|
180
|
+
* const output = await bundle.generate();
|
|
181
|
+
* const chunk = output.output[0];
|
|
182
|
+
*
|
|
183
|
+
* // Use the chunk...
|
|
184
|
+
*
|
|
185
|
+
* // Manually free the memory (fast, but accessing properties after will throw)
|
|
186
|
+
* const status = freeExternalMemory(chunk); // { freed: true }
|
|
187
|
+
* const statusAgain = freeExternalMemory(chunk); // { freed: false, reason: "Memory has already been freed" }
|
|
188
|
+
*
|
|
189
|
+
* // Keep data alive before freeing (slower, but data remains accessible)
|
|
190
|
+
* freeExternalMemory(chunk, true); // Evaluates all lazy fields first
|
|
191
|
+
* console.log(chunk.code); // OK - data was copied to JavaScript before freeing
|
|
192
|
+
*
|
|
193
|
+
* // Without keepDataAlive, accessing chunk properties after freeing will throw an error
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
function freeExternalMemory(handle, keepDataAlive = false) {
|
|
197
|
+
return handle[symbolForExternalMemoryHandle](keepDataAlive);
|
|
198
|
+
}
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/api/experimental.ts
|
|
201
|
+
/**
|
|
202
|
+
* This is an experimental API. Its behavior may change in the future.
|
|
203
|
+
*
|
|
204
|
+
* - Calling this API will only execute the `scan/build` stage of rolldown.
|
|
205
|
+
* - `scan` will clean up all resources automatically, but if you want to ensure timely cleanup, you need to wait for the returned promise to resolve.
|
|
206
|
+
*
|
|
207
|
+
* @example To ensure cleanup of resources, use the returned promise to wait for the scan to complete.
|
|
208
|
+
* ```ts
|
|
209
|
+
* import { scan } from 'rolldown/api/experimental';
|
|
210
|
+
*
|
|
211
|
+
* const cleanupPromise = await scan(...);
|
|
212
|
+
* await cleanupPromise;
|
|
213
|
+
* // Now all resources have been cleaned up.
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
const scan = async (rawInputOptions, rawOutputOptions = {}) => {
|
|
217
|
+
validateOption("input", rawInputOptions);
|
|
218
|
+
validateOption("output", rawOutputOptions);
|
|
219
|
+
const inputOptions = await PluginDriver.callOptionsHook(rawInputOptions);
|
|
220
|
+
const ret = await createBundlerOptions(inputOptions, rawOutputOptions, false);
|
|
221
|
+
const bundler = new import_binding.BindingBundler();
|
|
222
|
+
(0, import_binding.startAsyncRuntime)();
|
|
223
|
+
let cleanedUp = false;
|
|
224
|
+
async function cleanup() {
|
|
225
|
+
if (cleanedUp) return;
|
|
226
|
+
cleanedUp = true;
|
|
227
|
+
try {
|
|
228
|
+
await bundler.close();
|
|
229
|
+
await ret.stopWorkers?.();
|
|
230
|
+
} finally {
|
|
231
|
+
(0, import_binding.shutdownAsyncRuntime)();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
let cleanupPromise = Promise.resolve();
|
|
235
|
+
try {
|
|
236
|
+
const result = await bundler.scan(ret.bundlerOptions);
|
|
237
|
+
unwrapBindingResult(result);
|
|
238
|
+
} catch (err) {
|
|
239
|
+
await cleanup();
|
|
240
|
+
throw err;
|
|
241
|
+
} finally {
|
|
242
|
+
cleanupPromise = cleanup();
|
|
243
|
+
}
|
|
244
|
+
return cleanupPromise;
|
|
245
|
+
};
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region src/plugin/parallel-plugin.ts
|
|
248
|
+
function defineParallelPlugin(pluginPath) {
|
|
249
|
+
return (options) => {
|
|
250
|
+
return { _parallel: {
|
|
251
|
+
fileUrl: pathToFileURL(pluginPath).href,
|
|
252
|
+
options
|
|
253
|
+
} };
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region src/builtin-plugin/alias-plugin.ts
|
|
258
|
+
function viteAliasPlugin(config) {
|
|
259
|
+
return new BuiltinPlugin("builtin:vite-alias", config);
|
|
260
|
+
}
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/builtin-plugin/bundle-analyzer-plugin.ts
|
|
263
|
+
/**
|
|
264
|
+
* A plugin that analyzes bundle composition and generates detailed reports.
|
|
265
|
+
*
|
|
266
|
+
* The plugin outputs a file containing detailed information about:
|
|
267
|
+
* - All chunks and their relationships
|
|
268
|
+
* - Modules bundled in each chunk
|
|
269
|
+
* - Import dependencies between chunks
|
|
270
|
+
* - Reachable modules from each entry point
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* ```js
|
|
274
|
+
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
|
|
275
|
+
*
|
|
276
|
+
* export default {
|
|
277
|
+
* plugins: [
|
|
278
|
+
* bundleAnalyzerPlugin()
|
|
279
|
+
* ]
|
|
280
|
+
* }
|
|
281
|
+
* ```
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* **Custom filename**
|
|
285
|
+
* ```js
|
|
286
|
+
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
|
|
287
|
+
*
|
|
288
|
+
* export default {
|
|
289
|
+
* plugins: [
|
|
290
|
+
* bundleAnalyzerPlugin({
|
|
291
|
+
* fileName: 'bundle-analysis.json'
|
|
292
|
+
* })
|
|
293
|
+
* ]
|
|
294
|
+
* }
|
|
295
|
+
* ```
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* **LLM-friendly markdown output**
|
|
299
|
+
* ```js
|
|
300
|
+
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
|
|
301
|
+
*
|
|
302
|
+
* export default {
|
|
303
|
+
* plugins: [
|
|
304
|
+
* bundleAnalyzerPlugin({
|
|
305
|
+
* format: 'md'
|
|
306
|
+
* })
|
|
307
|
+
* ]
|
|
308
|
+
* }
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
function bundleAnalyzerPlugin(config) {
|
|
312
|
+
return new BuiltinPlugin("builtin:bundle-analyzer", config);
|
|
313
|
+
}
|
|
314
|
+
//#endregion
|
|
315
|
+
//#region src/builtin-plugin/transform-plugin.ts
|
|
316
|
+
function viteTransformPlugin(config) {
|
|
317
|
+
return new BuiltinPlugin("builtin:vite-transform", {
|
|
318
|
+
...config,
|
|
319
|
+
include: normalizedStringOrRegex(config.include),
|
|
320
|
+
exclude: normalizedStringOrRegex(config.exclude),
|
|
321
|
+
jsxRefreshInclude: normalizedStringOrRegex(config.jsxRefreshInclude),
|
|
322
|
+
jsxRefreshExclude: normalizedStringOrRegex(config.jsxRefreshExclude),
|
|
323
|
+
yarnPnp: typeof process === "object" && !!process.versions?.pnp
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region src/builtin-plugin/vite-manifest-plugin.ts
|
|
328
|
+
function viteManifestPlugin(config) {
|
|
329
|
+
return new BuiltinPlugin("builtin:vite-manifest", config);
|
|
330
|
+
}
|
|
331
|
+
//#endregion
|
|
332
|
+
//#region src/experimental-index.ts
|
|
333
|
+
/**
|
|
334
|
+
* In-memory file system for browser builds.
|
|
335
|
+
*
|
|
336
|
+
* This is a re-export of the {@link https://github.com/streamich/memfs | memfs} package used by the WASI runtime.
|
|
337
|
+
* It allows you to read and write files to a virtual filesystem when using rolldown in browser environments.
|
|
338
|
+
*
|
|
339
|
+
* - `fs`: A Node.js-compatible filesystem API (`IFs` from memfs)
|
|
340
|
+
* - `volume`: The underlying `Volume` instance that stores the filesystem state
|
|
341
|
+
*
|
|
342
|
+
* Returns `undefined` in Node.js builds (only available in browser builds via `@rolldown/browser`).
|
|
343
|
+
*
|
|
344
|
+
* @example
|
|
345
|
+
* ```typescript
|
|
346
|
+
* import { memfs } from 'rolldown/experimental';
|
|
347
|
+
*
|
|
348
|
+
* // Write files to virtual filesystem before bundling
|
|
349
|
+
* memfs?.volume.fromJSON({
|
|
350
|
+
* '/src/index.js': 'export const foo = 42;',
|
|
351
|
+
* '/package.json': '{"name": "my-app"}'
|
|
352
|
+
* });
|
|
353
|
+
*
|
|
354
|
+
* // Read files from the virtual filesystem
|
|
355
|
+
* const content = memfs?.fs.readFileSync('/src/index.js', 'utf8');
|
|
356
|
+
* ```
|
|
357
|
+
*
|
|
358
|
+
* @see {@link https://github.com/streamich/memfs} for more information on the memfs API.
|
|
359
|
+
*/
|
|
360
|
+
const memfs = void 0;
|
|
361
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
362
|
+
const parse = parse$1;
|
|
363
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
364
|
+
const parseSync = parseSync$1;
|
|
365
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
366
|
+
const minify = minify$1;
|
|
367
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
368
|
+
const minifySync = minifySync$1;
|
|
369
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
370
|
+
const transform = transform$1;
|
|
371
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
372
|
+
const transformSync = transformSync$1;
|
|
373
|
+
/** @deprecated Use from `rolldown/utils` instead. */
|
|
374
|
+
const TsconfigCache = TsconfigCache$1;
|
|
375
|
+
//#endregion
|
|
376
|
+
var BindingRebuildStrategy = import_binding.BindingRebuildStrategy;
|
|
377
|
+
var ResolverFactory = import_binding.ResolverFactory;
|
|
378
|
+
var getNativeMemoryStats = import_binding.getNativeMemoryStats;
|
|
379
|
+
var isolatedDeclaration = import_binding.isolatedDeclaration;
|
|
380
|
+
var isolatedDeclarationSync = import_binding.isolatedDeclarationSync;
|
|
381
|
+
var moduleRunnerTransform = import_binding.moduleRunnerTransform;
|
|
382
|
+
var resetNativeMemoryStats = import_binding.resetNativeMemoryStats;
|
|
383
|
+
export { BindingRebuildStrategy, DevEngine, ResolverFactory, TsconfigCache, bundleAnalyzerPlugin, defineParallelPlugin, dev, viteDynamicImportVarsPlugin as dynamicImportVarsPlugin, viteDynamicImportVarsPlugin, freeExternalMemory, getNativeMemoryStats, viteImportGlobPlugin as importGlobPlugin, viteImportGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, isolatedDeclarationSync, memfs, minify, minifySync, moduleRunnerTransform, oxcRuntimePlugin, parse, parseSync, resetNativeMemoryStats, resolveTsconfig, scan, transform, transformSync, viteAliasPlugin, viteBuildImportAnalysisPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReactRefreshWrapperPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWebWorkerPostPlugin };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
export var __create = Object.create;
|
|
2
|
+
export var __defProp = Object.defineProperty;
|
|
3
|
+
export var __name = (target, value) => __defProp(target, 'name', { value, configurable: true });
|
|
4
|
+
export var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
export var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
export var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
export var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
export var __esm = (fn, res, err) =>
|
|
9
|
+
function () {
|
|
10
|
+
if (err) throw err[0];
|
|
11
|
+
try {
|
|
12
|
+
return (fn && (res = (0, fn[__getOwnPropNames(fn)[0]])((fn = 0))), res);
|
|
13
|
+
} catch (e) {
|
|
14
|
+
throw ((err = [e]), e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export var __esmMin = (fn, res, err) => () => {
|
|
18
|
+
if (err) throw err[0];
|
|
19
|
+
try {
|
|
20
|
+
return (fn && (res = fn((fn = 0))), res);
|
|
21
|
+
} catch (e) {
|
|
22
|
+
throw ((err = [e]), e);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export var __commonJS = (cb, mod) =>
|
|
26
|
+
function () {
|
|
27
|
+
return (
|
|
28
|
+
mod || ((0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), cb = null), mod.exports
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
export var __commonJSMin = (cb, mod) => () => (
|
|
32
|
+
mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports
|
|
33
|
+
);
|
|
34
|
+
export var __exportAll = (all, no_symbols) => {
|
|
35
|
+
let target = {};
|
|
36
|
+
for (var name in all) {
|
|
37
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
38
|
+
}
|
|
39
|
+
if (!no_symbols) {
|
|
40
|
+
__defProp(target, Symbol.toStringTag, { value: 'Module' });
|
|
41
|
+
}
|
|
42
|
+
return target;
|
|
43
|
+
};
|
|
44
|
+
export var __copyProps = (to, from, except, desc) => {
|
|
45
|
+
if ((from && typeof from === 'object') || typeof from === 'function') {
|
|
46
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
47
|
+
key = keys[i];
|
|
48
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
49
|
+
__defProp(to, key, {
|
|
50
|
+
get: ((k) => from[k]).bind(null, key),
|
|
51
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return to;
|
|
57
|
+
};
|
|
58
|
+
export var __reExport = (target, mod, secondTarget) => (
|
|
59
|
+
__copyProps(target, mod, 'default'), secondTarget && __copyProps(secondTarget, mod, 'default')
|
|
60
|
+
);
|
|
61
|
+
export var __toESM = (mod, isNodeMode, target) => (
|
|
62
|
+
(target = mod != null ? __create(__getProtoOf(mod)) : {}),
|
|
63
|
+
__copyProps(
|
|
64
|
+
// `__esModule` alone is not enough: the module must own a `default` (#10360).
|
|
65
|
+
isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, 'default')
|
|
66
|
+
? __defProp(target, 'default', { value: mod, enumerable: true })
|
|
67
|
+
: target,
|
|
68
|
+
mod,
|
|
69
|
+
)
|
|
70
|
+
);
|
|
71
|
+
export var __toCommonJS = (mod) =>
|
|
72
|
+
__hasOwnProp.call(mod, 'module.exports')
|
|
73
|
+
? mod['module.exports']
|
|
74
|
+
: __copyProps(__defProp({}, '__esModule', { value: true }), mod);
|
|
75
|
+
export var __toBinaryNode = (base64) => new Uint8Array(Buffer.from(base64, 'base64'));
|
|
76
|
+
export var __toBinary = /* @__PURE__ */ (() => {
|
|
77
|
+
var table = new Uint8Array(128);
|
|
78
|
+
for (var i = 0; i < 64; i++) {
|
|
79
|
+
table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;
|
|
80
|
+
}
|
|
81
|
+
return (base64) => {
|
|
82
|
+
var n = base64.length,
|
|
83
|
+
bytes = new Uint8Array((((n - (base64[n - 1] == '=') - (base64[n - 2] == '=')) * 3) / 4) | 0);
|
|
84
|
+
for (var i = 0, j = 0; i < n; ) {
|
|
85
|
+
var c0 = table[base64.charCodeAt(i++)],
|
|
86
|
+
c1 = table[base64.charCodeAt(i++)];
|
|
87
|
+
var c2 = table[base64.charCodeAt(i++)],
|
|
88
|
+
c3 = table[base64.charCodeAt(i++)];
|
|
89
|
+
bytes[j++] = (c0 << 2) | (c1 >> 4);
|
|
90
|
+
bytes[j++] = (c1 << 4) | (c2 >> 2);
|
|
91
|
+
bytes[j++] = (c2 << 6) | c3;
|
|
92
|
+
}
|
|
93
|
+
return bytes;
|
|
94
|
+
};
|
|
95
|
+
})();
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compiler-emitted module-graph delta — pure topology (static + dynamic edges).
|
|
3
|
+
* `ids[0, localCount)` are the modules this payload carries; `ids[localCount, …)` are foreign edge targets.
|
|
4
|
+
* `edges[i]` / `dynamicEdges[i]` are the static / dynamic-`import()` out-edges of `ids[i]`.
|
|
5
|
+
* @typedef {{ ids: string[], localCount: number, edges: number[][], dynamicEdges?: number[][] }} ModuleGraphDelta
|
|
6
|
+
* @typedef {{ createModuleHotContext(moduleId: string): any, onModuleCacheRemoval(moduleId: string): void }} DevRuntimeHooks
|
|
7
|
+
*/
|
|
8
|
+
export class MissingFactoryError {
|
|
9
|
+
/**
|
|
10
|
+
* @param {string} id
|
|
11
|
+
*/
|
|
12
|
+
constructor(id: string);
|
|
13
|
+
id: string;
|
|
14
|
+
}
|
|
15
|
+
export class DevRuntime {
|
|
16
|
+
/**
|
|
17
|
+
* @param {string} clientId
|
|
18
|
+
*/
|
|
19
|
+
constructor(clientId: string);
|
|
20
|
+
/**
|
|
21
|
+
* Client ID generated at runtime initialization, used for lazy compilation requests.
|
|
22
|
+
* @type {string}
|
|
23
|
+
*/
|
|
24
|
+
clientId: string;
|
|
25
|
+
/**
|
|
26
|
+
* Static import edges from `registerGraph` — entries persist across `removeModuleCache`
|
|
27
|
+
* and change only by replacement from a newer payload (last write wins).
|
|
28
|
+
* @type {Map<string, { edges: string[] }>}
|
|
29
|
+
*/
|
|
30
|
+
staticImports: Map<string, {
|
|
31
|
+
edges: string[];
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* Reverse index over the static imports.
|
|
35
|
+
* @type {Map<string, Set<string>>}
|
|
36
|
+
*/
|
|
37
|
+
importers: Map<string, Set<string>>;
|
|
38
|
+
/**
|
|
39
|
+
* Dynamic `import()` edges from `registerGraph`, keyed by importer — mirror of
|
|
40
|
+
* `staticImports` for the dynamic reverse index.
|
|
41
|
+
* @type {Map<string, { edges: string[] }>}
|
|
42
|
+
*/
|
|
43
|
+
dynamicImports: Map<string, {
|
|
44
|
+
edges: string[];
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Reverse index over the dynamic imports.
|
|
48
|
+
* @type {Map<string, Set<string>>}
|
|
49
|
+
*/
|
|
50
|
+
dynamicImporters: Map<string, Set<string>>;
|
|
51
|
+
/**
|
|
52
|
+
* The module cache. Membership means "this module's side effects ran in this tab" —
|
|
53
|
+
* registration is emitted ahead of every module body, and nothing un-registers on
|
|
54
|
+
* unwind, so a factory that throws mid-body stays registered. A `Map` rather than a
|
|
55
|
+
* plain object: HMR eviction deletes entries, and a `delete` on an object drops V8
|
|
56
|
+
* into dictionary mode, taxing every later lookup on the hottest read path.
|
|
57
|
+
* @type {Map<string, Module>}
|
|
58
|
+
*/
|
|
59
|
+
moduleCache: Map<string, Module>;
|
|
60
|
+
/**
|
|
61
|
+
* Re-runnable factories from HMR patches and lazy chunks. The initial bundle stays
|
|
62
|
+
* scope-hoisted and contributes none.
|
|
63
|
+
* @type {Map<string, { kind: 'esm' | 'cjs', fn: (id: string) => void }>}
|
|
64
|
+
*/
|
|
65
|
+
factories: Map<string, {
|
|
66
|
+
kind: "esm" | "cjs";
|
|
67
|
+
fn: (id: string) => void;
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* Installed by the dev client at boot. The runtime is a store + executor and makes
|
|
71
|
+
* no HMR decisions; accepting, disposing, and reloading live behind these hooks.
|
|
72
|
+
* @type {DevRuntimeHooks | null}
|
|
73
|
+
*/
|
|
74
|
+
hooks: DevRuntimeHooks | null;
|
|
75
|
+
/**
|
|
76
|
+
* @param {ModuleGraphDelta} delta
|
|
77
|
+
*/
|
|
78
|
+
registerGraph(delta: ModuleGraphDelta): void;
|
|
79
|
+
/**
|
|
80
|
+
* @param {string} id
|
|
81
|
+
* @param {'esm' | 'cjs'} kind
|
|
82
|
+
* @param {(id: string) => void} fn
|
|
83
|
+
*/
|
|
84
|
+
registerFactory(id: string, kind: "esm" | "cjs", fn: (id: string) => void): void;
|
|
85
|
+
/**
|
|
86
|
+
* @param {string} id
|
|
87
|
+
* @param {{ exports: any }} [exportsHolder]
|
|
88
|
+
*/
|
|
89
|
+
registerModule(id: string, exportsHolder?: {
|
|
90
|
+
exports: any;
|
|
91
|
+
}): void;
|
|
92
|
+
/**
|
|
93
|
+
* @param {string} id
|
|
94
|
+
* @returns {string[]}
|
|
95
|
+
*/
|
|
96
|
+
getImporters(id: string): string[];
|
|
97
|
+
/**
|
|
98
|
+
* @param {string} id
|
|
99
|
+
*/
|
|
100
|
+
isExecuted(id: string): any;
|
|
101
|
+
/**
|
|
102
|
+
* @param {string} id
|
|
103
|
+
*/
|
|
104
|
+
hasFactory(id: string): any;
|
|
105
|
+
/**
|
|
106
|
+
* Module-cache delete only — static imports and factories persist. Removal is what
|
|
107
|
+
* re-arms a cache-gated factory for `initModule`.
|
|
108
|
+
* @param {string} id
|
|
109
|
+
*/
|
|
110
|
+
removeModuleCache(id: string): void;
|
|
111
|
+
/**
|
|
112
|
+
* The one re-execution gate: registered → return the live exports; otherwise run the
|
|
113
|
+
* mapped factory (which registers itself first, then runs the body).
|
|
114
|
+
* @param {string} id
|
|
115
|
+
*/
|
|
116
|
+
initModule(id: string): any;
|
|
117
|
+
/**
|
|
118
|
+
* @param {string} id
|
|
119
|
+
*/
|
|
120
|
+
loadExports(id: string): any;
|
|
121
|
+
/**
|
|
122
|
+
* @param {string} moduleId
|
|
123
|
+
*/
|
|
124
|
+
createModuleHotContext(moduleId: string): any;
|
|
125
|
+
/** @internal */
|
|
126
|
+
__toESM: any;
|
|
127
|
+
/** @internal */
|
|
128
|
+
__toCommonJS: any;
|
|
129
|
+
/** @internal */
|
|
130
|
+
__exportAll: any;
|
|
131
|
+
/**
|
|
132
|
+
* @param {boolean} [isNodeMode]
|
|
133
|
+
* @returns {(mod: any) => any}
|
|
134
|
+
* @internal
|
|
135
|
+
*/
|
|
136
|
+
__toDynamicImportESM: (isNodeMode?: boolean) => (mod: any) => any;
|
|
137
|
+
/** @internal */
|
|
138
|
+
__reExport: any;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Compiler-emitted module-graph delta — pure topology (static + dynamic edges).
|
|
142
|
+
* `ids[0, localCount)` are the modules this payload carries; `ids[localCount, …)` are foreign edge targets.
|
|
143
|
+
* `edges[i]` / `dynamicEdges[i]` are the static / dynamic-`import()` out-edges of `ids[i]`.
|
|
144
|
+
*/
|
|
145
|
+
export type ModuleGraphDelta = {
|
|
146
|
+
ids: string[];
|
|
147
|
+
localCount: number;
|
|
148
|
+
edges: number[][];
|
|
149
|
+
dynamicEdges?: number[][];
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Compiler-emitted module-graph delta — pure topology (static + dynamic edges).
|
|
153
|
+
* `ids[0, localCount)` are the modules this payload carries; `ids[localCount, …)` are foreign edge targets.
|
|
154
|
+
* `edges[i]` / `dynamicEdges[i]` are the static / dynamic-`import()` out-edges of `ids[i]`.
|
|
155
|
+
*/
|
|
156
|
+
export type DevRuntimeHooks = {
|
|
157
|
+
createModuleHotContext(moduleId: string): any;
|
|
158
|
+
onModuleCacheRemoval(moduleId: string): void;
|
|
159
|
+
};
|
|
160
|
+
declare class Module {
|
|
161
|
+
/**
|
|
162
|
+
* @param {string} id
|
|
163
|
+
*/
|
|
164
|
+
constructor(id: string);
|
|
165
|
+
/**
|
|
166
|
+
* @type {{ exports: any }}
|
|
167
|
+
*/
|
|
168
|
+
exportsHolder: {
|
|
169
|
+
exports: any;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* @type {string}
|
|
173
|
+
*/
|
|
174
|
+
id: string;
|
|
175
|
+
get exports(): any;
|
|
176
|
+
}
|
|
177
|
+
export {};
|