@rollipop/rolldown 0.0.0-beta.0 → 0.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-setup.mjs +1 -1
- package/dist/cli.mjs +37 -37
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +7 -7
- package/dist/experimental-index.d.mts +4 -62
- package/dist/experimental-index.mjs +7 -40
- package/dist/experimental-runtime-types.d.ts +12 -1
- package/dist/filter-index.d.mts +2 -2
- package/dist/filter-index.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +7 -7
- package/dist/parallel-plugin-worker.mjs +4 -4
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +2 -2
- package/dist/plugins-index.d.mts +3 -3
- package/dist/plugins-index.mjs +3 -3
- package/dist/shared/{binding-kAegJ1Bj.d.mts → binding-C9YdqoUG.d.mts} +2 -120
- package/dist/shared/{binding-DmMMxMk0.mjs → binding-DkwjzGvT.mjs} +26 -27
- package/dist/shared/{bindingify-input-options-D0BAGfk2.mjs → bindingify-input-options-BioA6ADH.mjs} +573 -21
- package/dist/shared/{constructors-Rl_oLd2F.mjs → constructors-CQbXvIw9.mjs} +2 -8
- package/dist/shared/{constructors-F44lhsH3.d.mts → constructors-D9F4Aj4h.d.mts} +3 -5
- package/dist/shared/{define-config-DJ1-iIdx.d.mts → define-config-glNgjHCc.d.mts} +12 -1
- package/dist/shared/{load-config-BEpugZky.mjs → load-config-BsPJHbns.mjs} +1 -1
- package/dist/shared/{logs-cyjC0SDv.mjs → logs-N5Akftom.mjs} +2 -2
- package/dist/shared/normalize-string-or-regex-CYnwzi7f.mjs +61 -0
- package/dist/shared/{parse-ast-index-BuuhACPk.mjs → parse-ast-index-D50raXC6.mjs} +2 -2
- package/dist/shared/{prompt-5sWCM0jm.mjs → prompt-BZ-QjPVS.mjs} +45 -45
- package/dist/shared/{rolldown-build-viDZfkdI.mjs → rolldown-build-Dc6MJ2CU.mjs} +16 -14
- package/dist/shared/{rolldown-il0-nWH9.mjs → rolldown-nC7B9qvJ.mjs} +1 -1
- package/dist/shared/{watch-BSdMzY6q.mjs → watch-C1nsTy4z.mjs} +5 -6
- package/package.json +11 -11
- package/dist/shared/normalize-string-or-regex-DbTZ9prS.mjs +0 -670
- /package/dist/shared/{misc-DpjTMcQQ.mjs → misc-0HsaOsAX.mjs} +0 -0
package/dist/shared/{bindingify-input-options-D0BAGfk2.mjs → bindingify-input-options-BioA6ADH.mjs}
RENAMED
|
@@ -1,12 +1,51 @@
|
|
|
1
|
-
import { n as __toESM, t as require_binding } from "./binding-
|
|
2
|
-
import { c as logPluginError, n as error, r as logCycleLoading, t as augmentCodeLocation } from "./logs-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as parseAst } from "./parse-ast-index-
|
|
1
|
+
import { n as __toESM, t as require_binding } from "./binding-DkwjzGvT.mjs";
|
|
2
|
+
import { a as logInvalidLogPosition, c as logPluginError, n as error, r as logCycleLoading, t as augmentCodeLocation } from "./logs-N5Akftom.mjs";
|
|
3
|
+
import { i as bindingifyManifestPlugin, n as BuiltinPlugin, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-CYnwzi7f.mjs";
|
|
4
|
+
import { a as unreachable, o as unsupported, r as noop, t as arraify } from "./misc-0HsaOsAX.mjs";
|
|
5
|
+
import { t as parseAst } from "./parse-ast-index-D50raXC6.mjs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import * as filter from "@rollipop/rolldown-pluginutils";
|
|
8
8
|
import fsp from "node:fs/promises";
|
|
9
9
|
|
|
10
|
+
//#region package.json
|
|
11
|
+
var version = "0.0.0-beta.2";
|
|
12
|
+
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/version.ts
|
|
16
|
+
/** @category Plugin APIs */
|
|
17
|
+
const VERSION = version;
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/log/logging.ts
|
|
21
|
+
const LOG_LEVEL_SILENT = "silent";
|
|
22
|
+
const LOG_LEVEL_ERROR = "error";
|
|
23
|
+
const LOG_LEVEL_WARN = "warn";
|
|
24
|
+
const LOG_LEVEL_INFO = "info";
|
|
25
|
+
const LOG_LEVEL_DEBUG = "debug";
|
|
26
|
+
const logLevelPriority = {
|
|
27
|
+
[LOG_LEVEL_DEBUG]: 0,
|
|
28
|
+
[LOG_LEVEL_INFO]: 1,
|
|
29
|
+
[LOG_LEVEL_WARN]: 2,
|
|
30
|
+
[LOG_LEVEL_SILENT]: 3
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/log/log-handler.ts
|
|
35
|
+
const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
|
|
36
|
+
function getLogHandler(level, code, logger, pluginName, logLevel) {
|
|
37
|
+
if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
|
|
38
|
+
return (log, pos) => {
|
|
39
|
+
if (pos != null) logger(LOG_LEVEL_WARN, logInvalidLogPosition(pluginName));
|
|
40
|
+
log = normalizeLog(log);
|
|
41
|
+
if (log.code && !log.pluginCode) log.pluginCode = log.code;
|
|
42
|
+
log.code = code;
|
|
43
|
+
log.plugin = pluginName;
|
|
44
|
+
logger(level, log);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
10
49
|
//#region src/utils/normalize-hook.ts
|
|
11
50
|
function normalizeHook(hook) {
|
|
12
51
|
if (typeof hook === "function" || typeof hook === "string") return {
|
|
@@ -25,6 +64,521 @@ function normalizeHook(hook) {
|
|
|
25
64
|
unreachable("Invalid hook type");
|
|
26
65
|
}
|
|
27
66
|
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/plugin/minimal-plugin-context.ts
|
|
69
|
+
var MinimalPluginContextImpl = class {
|
|
70
|
+
info;
|
|
71
|
+
warn;
|
|
72
|
+
debug;
|
|
73
|
+
meta;
|
|
74
|
+
constructor(onLog, logLevel, pluginName, watchMode, hookName) {
|
|
75
|
+
this.pluginName = pluginName;
|
|
76
|
+
this.hookName = hookName;
|
|
77
|
+
this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
78
|
+
this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
79
|
+
this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
|
|
80
|
+
this.meta = {
|
|
81
|
+
rollupVersion: "4.23.0",
|
|
82
|
+
rolldownVersion: VERSION,
|
|
83
|
+
watchMode
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
error(e$1) {
|
|
87
|
+
return error(logPluginError(normalizeLog(e$1), this.pluginName, { hook: this.hookName }));
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/types/plain-object-like.ts
|
|
93
|
+
const LAZY_FIELDS_KEY = Symbol("__lazy_fields__");
|
|
94
|
+
/**
|
|
95
|
+
* Base class for classes that use `@lazyProp` decorated properties.
|
|
96
|
+
*
|
|
97
|
+
* **Design Pattern in Rolldown:**
|
|
98
|
+
* This is a common pattern in Rolldown due to its three-layer architecture:
|
|
99
|
+
* TypeScript API → NAPI Bindings → Rust Core
|
|
100
|
+
*
|
|
101
|
+
* **Why we use getters:**
|
|
102
|
+
* For performance - to lazily fetch data from Rust bindings only when needed,
|
|
103
|
+
* rather than eagerly fetching all data during object construction.
|
|
104
|
+
*
|
|
105
|
+
* **The problem:**
|
|
106
|
+
* Getters defined on class prototypes are non-enumerable by default, which breaks:
|
|
107
|
+
* - Object spread operators ({...obj})
|
|
108
|
+
* - Object.keys() and similar methods
|
|
109
|
+
* - Standard JavaScript object semantics
|
|
110
|
+
*
|
|
111
|
+
* **The solution:**
|
|
112
|
+
* This base class automatically converts `@lazyProp` decorated getters into
|
|
113
|
+
* own enumerable getters on each instance during construction.
|
|
114
|
+
*
|
|
115
|
+
* **Result:**
|
|
116
|
+
* Objects get both lazy-loading performance benefits AND plain JavaScript object behavior.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* class MyClass extends PlainObjectLike {
|
|
121
|
+
* @lazyProp
|
|
122
|
+
* get myProp() {
|
|
123
|
+
* return fetchFromRustBinding();
|
|
124
|
+
* }
|
|
125
|
+
* }
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
var PlainObjectLike = class {
|
|
129
|
+
constructor() {
|
|
130
|
+
setupLazyProperties(this);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Set up lazy properties as own getters on an instance.
|
|
135
|
+
* This is called automatically by the `PlainObjectLike` base class constructor.
|
|
136
|
+
*
|
|
137
|
+
* @param instance - The instance to set up lazy properties on
|
|
138
|
+
* @internal
|
|
139
|
+
*/
|
|
140
|
+
function setupLazyProperties(instance) {
|
|
141
|
+
const lazyFields = instance.constructor[LAZY_FIELDS_KEY];
|
|
142
|
+
if (!lazyFields) return;
|
|
143
|
+
for (const [propertyKey, originalGetter] of lazyFields.entries()) {
|
|
144
|
+
let cachedValue;
|
|
145
|
+
let hasValue = false;
|
|
146
|
+
Object.defineProperty(instance, propertyKey, {
|
|
147
|
+
get() {
|
|
148
|
+
if (!hasValue) {
|
|
149
|
+
cachedValue = originalGetter.call(this);
|
|
150
|
+
hasValue = true;
|
|
151
|
+
}
|
|
152
|
+
return cachedValue;
|
|
153
|
+
},
|
|
154
|
+
enumerable: true,
|
|
155
|
+
configurable: true
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Get all lazy field names from a class instance.
|
|
161
|
+
*
|
|
162
|
+
* @param instance - Instance to inspect
|
|
163
|
+
* @returns Set of lazy property names
|
|
164
|
+
*/
|
|
165
|
+
function getLazyFields(instance) {
|
|
166
|
+
const lazyFields = instance.constructor[LAZY_FIELDS_KEY];
|
|
167
|
+
return lazyFields ? new Set(lazyFields.keys()) : /* @__PURE__ */ new Set();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/decorators/lazy.ts
|
|
172
|
+
/**
|
|
173
|
+
* Decorator that marks a getter as lazy-evaluated and cached.
|
|
174
|
+
*
|
|
175
|
+
* **What "lazy" means here:**
|
|
176
|
+
* 1. Data is lazily fetched from Rust bindings only when the property is accessed (not eagerly on construction)
|
|
177
|
+
* 2. Once fetched, the data is cached for subsequent accesses (performance optimization)
|
|
178
|
+
* 3. Despite being a getter, it behaves like a plain object property (enumerable, appears in Object.keys())
|
|
179
|
+
*
|
|
180
|
+
* **Important**: Properties decorated with `@lazyProp` are defined as own enumerable
|
|
181
|
+
* properties on each instance (not on the prototype). This ensures they:
|
|
182
|
+
* - Appear in Object.keys() and Object.getOwnPropertyNames()
|
|
183
|
+
* - Are included in object spreads ({...obj})
|
|
184
|
+
* - Are enumerable in for...in loops
|
|
185
|
+
*
|
|
186
|
+
* Classes using this decorator must extend `PlainObjectLike` base class.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```typescript
|
|
190
|
+
* class MyClass extends PlainObjectLike {
|
|
191
|
+
* @lazyProp
|
|
192
|
+
* get expensiveValue() {
|
|
193
|
+
* return someExpensiveComputation();
|
|
194
|
+
* }
|
|
195
|
+
* }
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
function lazyProp(target, propertyKey, descriptor) {
|
|
199
|
+
if (!target.constructor[LAZY_FIELDS_KEY]) target.constructor[LAZY_FIELDS_KEY] = /* @__PURE__ */ new Map();
|
|
200
|
+
const originalGetter = descriptor.get;
|
|
201
|
+
target.constructor[LAZY_FIELDS_KEY].set(propertyKey, originalGetter);
|
|
202
|
+
return {
|
|
203
|
+
enumerable: false,
|
|
204
|
+
configurable: true
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/utils/asset-source.ts
|
|
210
|
+
function transformAssetSource(bindingAssetSource) {
|
|
211
|
+
return bindingAssetSource.inner;
|
|
212
|
+
}
|
|
213
|
+
function bindingAssetSource(source) {
|
|
214
|
+
return { inner: source };
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region \0@oxc-project+runtime@0.108.0/helpers/decorate.js
|
|
219
|
+
function __decorate(decorators, target, key, desc) {
|
|
220
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
221
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
222
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
223
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/types/output-asset-impl.ts
|
|
228
|
+
var OutputAssetImpl = class extends PlainObjectLike {
|
|
229
|
+
type = "asset";
|
|
230
|
+
constructor(bindingAsset) {
|
|
231
|
+
super();
|
|
232
|
+
this.bindingAsset = bindingAsset;
|
|
233
|
+
}
|
|
234
|
+
get fileName() {
|
|
235
|
+
return this.bindingAsset.getFileName();
|
|
236
|
+
}
|
|
237
|
+
get originalFileName() {
|
|
238
|
+
return this.bindingAsset.getOriginalFileName() || null;
|
|
239
|
+
}
|
|
240
|
+
get originalFileNames() {
|
|
241
|
+
return this.bindingAsset.getOriginalFileNames();
|
|
242
|
+
}
|
|
243
|
+
get name() {
|
|
244
|
+
return this.bindingAsset.getName() ?? void 0;
|
|
245
|
+
}
|
|
246
|
+
get names() {
|
|
247
|
+
return this.bindingAsset.getNames();
|
|
248
|
+
}
|
|
249
|
+
get source() {
|
|
250
|
+
return transformAssetSource(this.bindingAsset.getSource());
|
|
251
|
+
}
|
|
252
|
+
__rolldown_external_memory_handle__(keepDataAlive) {
|
|
253
|
+
if (keepDataAlive) this.#evaluateAllLazyFields();
|
|
254
|
+
return this.bindingAsset.dropInner();
|
|
255
|
+
}
|
|
256
|
+
#evaluateAllLazyFields() {
|
|
257
|
+
for (const field of getLazyFields(this)) this[field];
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
__decorate([lazyProp], OutputAssetImpl.prototype, "fileName", null);
|
|
261
|
+
__decorate([lazyProp], OutputAssetImpl.prototype, "originalFileName", null);
|
|
262
|
+
__decorate([lazyProp], OutputAssetImpl.prototype, "originalFileNames", null);
|
|
263
|
+
__decorate([lazyProp], OutputAssetImpl.prototype, "name", null);
|
|
264
|
+
__decorate([lazyProp], OutputAssetImpl.prototype, "names", null);
|
|
265
|
+
__decorate([lazyProp], OutputAssetImpl.prototype, "source", null);
|
|
266
|
+
|
|
267
|
+
//#endregion
|
|
268
|
+
//#region src/utils/transform-rendered-module.ts
|
|
269
|
+
function transformToRenderedModule(bindingRenderedModule) {
|
|
270
|
+
return {
|
|
271
|
+
get code() {
|
|
272
|
+
return bindingRenderedModule.code;
|
|
273
|
+
},
|
|
274
|
+
get renderedLength() {
|
|
275
|
+
return bindingRenderedModule.code?.length || 0;
|
|
276
|
+
},
|
|
277
|
+
get renderedExports() {
|
|
278
|
+
return bindingRenderedModule.renderedExports;
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region src/utils/transform-rendered-chunk.ts
|
|
285
|
+
function transformRenderedChunk(chunk) {
|
|
286
|
+
let modules = null;
|
|
287
|
+
return {
|
|
288
|
+
type: "chunk",
|
|
289
|
+
get name() {
|
|
290
|
+
return chunk.name;
|
|
291
|
+
},
|
|
292
|
+
get isEntry() {
|
|
293
|
+
return chunk.isEntry;
|
|
294
|
+
},
|
|
295
|
+
get isDynamicEntry() {
|
|
296
|
+
return chunk.isDynamicEntry;
|
|
297
|
+
},
|
|
298
|
+
get facadeModuleId() {
|
|
299
|
+
return chunk.facadeModuleId;
|
|
300
|
+
},
|
|
301
|
+
get moduleIds() {
|
|
302
|
+
return chunk.moduleIds;
|
|
303
|
+
},
|
|
304
|
+
get exports() {
|
|
305
|
+
return chunk.exports;
|
|
306
|
+
},
|
|
307
|
+
get fileName() {
|
|
308
|
+
return chunk.fileName;
|
|
309
|
+
},
|
|
310
|
+
get imports() {
|
|
311
|
+
return chunk.imports;
|
|
312
|
+
},
|
|
313
|
+
get dynamicImports() {
|
|
314
|
+
return chunk.dynamicImports;
|
|
315
|
+
},
|
|
316
|
+
get modules() {
|
|
317
|
+
if (!modules) modules = transformChunkModules(chunk.modules);
|
|
318
|
+
return modules;
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
function transformChunkModules(modules) {
|
|
323
|
+
const result = {};
|
|
324
|
+
for (let i = 0; i < modules.values.length; i++) {
|
|
325
|
+
let key = modules.keys[i];
|
|
326
|
+
const mod = modules.values[i];
|
|
327
|
+
result[key] = transformToRenderedModule(mod);
|
|
328
|
+
}
|
|
329
|
+
return result;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
//#endregion
|
|
333
|
+
//#region src/types/output-chunk-impl.ts
|
|
334
|
+
var OutputChunkImpl = class extends PlainObjectLike {
|
|
335
|
+
type = "chunk";
|
|
336
|
+
constructor(bindingChunk) {
|
|
337
|
+
super();
|
|
338
|
+
this.bindingChunk = bindingChunk;
|
|
339
|
+
}
|
|
340
|
+
get fileName() {
|
|
341
|
+
return this.bindingChunk.getFileName();
|
|
342
|
+
}
|
|
343
|
+
get name() {
|
|
344
|
+
return this.bindingChunk.getName();
|
|
345
|
+
}
|
|
346
|
+
get exports() {
|
|
347
|
+
return this.bindingChunk.getExports();
|
|
348
|
+
}
|
|
349
|
+
get isEntry() {
|
|
350
|
+
return this.bindingChunk.getIsEntry();
|
|
351
|
+
}
|
|
352
|
+
get facadeModuleId() {
|
|
353
|
+
return this.bindingChunk.getFacadeModuleId() || null;
|
|
354
|
+
}
|
|
355
|
+
get isDynamicEntry() {
|
|
356
|
+
return this.bindingChunk.getIsDynamicEntry();
|
|
357
|
+
}
|
|
358
|
+
get sourcemapFileName() {
|
|
359
|
+
return this.bindingChunk.getSourcemapFileName() || null;
|
|
360
|
+
}
|
|
361
|
+
get preliminaryFileName() {
|
|
362
|
+
return this.bindingChunk.getPreliminaryFileName();
|
|
363
|
+
}
|
|
364
|
+
get code() {
|
|
365
|
+
return this.bindingChunk.getCode();
|
|
366
|
+
}
|
|
367
|
+
get modules() {
|
|
368
|
+
return transformChunkModules(this.bindingChunk.getModules());
|
|
369
|
+
}
|
|
370
|
+
get imports() {
|
|
371
|
+
return this.bindingChunk.getImports();
|
|
372
|
+
}
|
|
373
|
+
get dynamicImports() {
|
|
374
|
+
return this.bindingChunk.getDynamicImports();
|
|
375
|
+
}
|
|
376
|
+
get moduleIds() {
|
|
377
|
+
return this.bindingChunk.getModuleIds();
|
|
378
|
+
}
|
|
379
|
+
get map() {
|
|
380
|
+
const mapString = this.bindingChunk.getMap();
|
|
381
|
+
return mapString ? transformToRollupSourceMap(mapString) : null;
|
|
382
|
+
}
|
|
383
|
+
__rolldown_external_memory_handle__(keepDataAlive) {
|
|
384
|
+
if (keepDataAlive) this.#evaluateAllLazyFields();
|
|
385
|
+
return this.bindingChunk.dropInner();
|
|
386
|
+
}
|
|
387
|
+
#evaluateAllLazyFields() {
|
|
388
|
+
for (const field of getLazyFields(this)) this[field];
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "fileName", null);
|
|
392
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "name", null);
|
|
393
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "exports", null);
|
|
394
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "isEntry", null);
|
|
395
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "facadeModuleId", null);
|
|
396
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "isDynamicEntry", null);
|
|
397
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "sourcemapFileName", null);
|
|
398
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "preliminaryFileName", null);
|
|
399
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "code", null);
|
|
400
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "modules", null);
|
|
401
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "imports", null);
|
|
402
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "dynamicImports", null);
|
|
403
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "moduleIds", null);
|
|
404
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "map", null);
|
|
405
|
+
|
|
406
|
+
//#endregion
|
|
407
|
+
//#region src/types/sourcemap.ts
|
|
408
|
+
function bindingifySourcemap(map) {
|
|
409
|
+
if (map == null) return;
|
|
410
|
+
return { inner: typeof map === "string" ? map : {
|
|
411
|
+
file: map.file ?? void 0,
|
|
412
|
+
mappings: map.mappings,
|
|
413
|
+
sourceRoot: "sourceRoot" in map ? map.sourceRoot ?? void 0 : void 0,
|
|
414
|
+
sources: map.sources?.map((s) => s ?? void 0),
|
|
415
|
+
sourcesContent: map.sourcesContent?.map((s) => s ?? void 0),
|
|
416
|
+
names: map.names,
|
|
417
|
+
x_google_ignoreList: map.x_google_ignoreList,
|
|
418
|
+
debugId: "debugId" in map ? map.debugId : void 0
|
|
419
|
+
} };
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
//#endregion
|
|
423
|
+
//#region src/utils/transform-to-rollup-output.ts
|
|
424
|
+
function transformToRollupSourceMap(map) {
|
|
425
|
+
const obj = {
|
|
426
|
+
...JSON.parse(map),
|
|
427
|
+
toString() {
|
|
428
|
+
return JSON.stringify(obj);
|
|
429
|
+
},
|
|
430
|
+
toUrl() {
|
|
431
|
+
return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
return obj;
|
|
435
|
+
}
|
|
436
|
+
function transformToRollupOutputChunk(bindingChunk) {
|
|
437
|
+
return new OutputChunkImpl(bindingChunk);
|
|
438
|
+
}
|
|
439
|
+
function transformToMutableRollupOutputChunk(bindingChunk, changed) {
|
|
440
|
+
const chunk = {
|
|
441
|
+
type: "chunk",
|
|
442
|
+
get code() {
|
|
443
|
+
return bindingChunk.getCode();
|
|
444
|
+
},
|
|
445
|
+
fileName: bindingChunk.getFileName(),
|
|
446
|
+
name: bindingChunk.getName(),
|
|
447
|
+
get modules() {
|
|
448
|
+
return transformChunkModules(bindingChunk.getModules());
|
|
449
|
+
},
|
|
450
|
+
get imports() {
|
|
451
|
+
return bindingChunk.getImports();
|
|
452
|
+
},
|
|
453
|
+
get dynamicImports() {
|
|
454
|
+
return bindingChunk.getDynamicImports();
|
|
455
|
+
},
|
|
456
|
+
exports: bindingChunk.getExports(),
|
|
457
|
+
isEntry: bindingChunk.getIsEntry(),
|
|
458
|
+
facadeModuleId: bindingChunk.getFacadeModuleId() || null,
|
|
459
|
+
isDynamicEntry: bindingChunk.getIsDynamicEntry(),
|
|
460
|
+
get moduleIds() {
|
|
461
|
+
return bindingChunk.getModuleIds();
|
|
462
|
+
},
|
|
463
|
+
get map() {
|
|
464
|
+
const map = bindingChunk.getMap();
|
|
465
|
+
return map ? transformToRollupSourceMap(map) : null;
|
|
466
|
+
},
|
|
467
|
+
sourcemapFileName: bindingChunk.getSourcemapFileName() || null,
|
|
468
|
+
preliminaryFileName: bindingChunk.getPreliminaryFileName()
|
|
469
|
+
};
|
|
470
|
+
const cache = {};
|
|
471
|
+
return new Proxy(chunk, {
|
|
472
|
+
get(target, p) {
|
|
473
|
+
if (p in cache) return cache[p];
|
|
474
|
+
const value = target[p];
|
|
475
|
+
cache[p] = value;
|
|
476
|
+
return value;
|
|
477
|
+
},
|
|
478
|
+
set(_target, p, newValue) {
|
|
479
|
+
cache[p] = newValue;
|
|
480
|
+
changed.updated.add(bindingChunk.getFileName());
|
|
481
|
+
return true;
|
|
482
|
+
},
|
|
483
|
+
has(target, p) {
|
|
484
|
+
if (p in cache) return true;
|
|
485
|
+
return p in target;
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
function transformToRollupOutputAsset(bindingAsset) {
|
|
490
|
+
return new OutputAssetImpl(bindingAsset);
|
|
491
|
+
}
|
|
492
|
+
function transformToMutableRollupOutputAsset(bindingAsset, changed) {
|
|
493
|
+
const asset = {
|
|
494
|
+
type: "asset",
|
|
495
|
+
fileName: bindingAsset.getFileName(),
|
|
496
|
+
originalFileName: bindingAsset.getOriginalFileName() || null,
|
|
497
|
+
originalFileNames: bindingAsset.getOriginalFileNames(),
|
|
498
|
+
get source() {
|
|
499
|
+
return transformAssetSource(bindingAsset.getSource());
|
|
500
|
+
},
|
|
501
|
+
name: bindingAsset.getName() ?? void 0,
|
|
502
|
+
names: bindingAsset.getNames()
|
|
503
|
+
};
|
|
504
|
+
const cache = {};
|
|
505
|
+
return new Proxy(asset, {
|
|
506
|
+
get(target, p) {
|
|
507
|
+
if (p in cache) return cache[p];
|
|
508
|
+
const value = target[p];
|
|
509
|
+
cache[p] = value;
|
|
510
|
+
return value;
|
|
511
|
+
},
|
|
512
|
+
set(_target, p, newValue) {
|
|
513
|
+
cache[p] = newValue;
|
|
514
|
+
changed.updated.add(bindingAsset.getFileName());
|
|
515
|
+
return true;
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
function transformToRollupOutput(output) {
|
|
520
|
+
const { chunks, assets } = output;
|
|
521
|
+
return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk)), ...assets.map((asset) => transformToRollupOutputAsset(asset))] };
|
|
522
|
+
}
|
|
523
|
+
function transformToMutableRollupOutput(output, changed) {
|
|
524
|
+
const { chunks, assets } = output;
|
|
525
|
+
return { output: [...chunks.map((chunk) => transformToMutableRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToMutableRollupOutputAsset(asset, changed))] };
|
|
526
|
+
}
|
|
527
|
+
function transformToOutputBundle(context, output, changed) {
|
|
528
|
+
const bundle = Object.fromEntries(transformToMutableRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
|
|
529
|
+
return new Proxy(bundle, {
|
|
530
|
+
set(_target, _p, _newValue, _receiver) {
|
|
531
|
+
const originalStackTraceLimit = Error.stackTraceLimit;
|
|
532
|
+
Error.stackTraceLimit = 2;
|
|
533
|
+
const message = "This plugin assigns to bundle variable. This is discouraged by Rollup and is not supported by Rolldown. This will be ignored. https://rollupjs.org/plugin-development/#generatebundle:~:text=DANGER,this.emitFile.";
|
|
534
|
+
const stack = new Error(message).stack ?? message;
|
|
535
|
+
Error.stackTraceLimit = originalStackTraceLimit;
|
|
536
|
+
context.warn({
|
|
537
|
+
message: stack,
|
|
538
|
+
code: "UNSUPPORTED_BUNDLE_ASSIGNMENT"
|
|
539
|
+
});
|
|
540
|
+
return true;
|
|
541
|
+
},
|
|
542
|
+
deleteProperty(target, property) {
|
|
543
|
+
if (typeof property === "string") changed.deleted.add(property);
|
|
544
|
+
return true;
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
function collectChangedBundle(changed, bundle) {
|
|
549
|
+
const changes = {};
|
|
550
|
+
for (const key in bundle) {
|
|
551
|
+
if (changed.deleted.has(key) || !changed.updated.has(key)) continue;
|
|
552
|
+
const item = bundle[key];
|
|
553
|
+
if (item.type === "asset") changes[key] = {
|
|
554
|
+
filename: item.fileName,
|
|
555
|
+
originalFileNames: item.originalFileNames,
|
|
556
|
+
source: bindingAssetSource(item.source),
|
|
557
|
+
names: item.names
|
|
558
|
+
};
|
|
559
|
+
else changes[key] = {
|
|
560
|
+
code: item.code,
|
|
561
|
+
filename: item.fileName,
|
|
562
|
+
name: item.name,
|
|
563
|
+
isEntry: item.isEntry,
|
|
564
|
+
exports: item.exports,
|
|
565
|
+
modules: {},
|
|
566
|
+
imports: item.imports,
|
|
567
|
+
dynamicImports: item.dynamicImports,
|
|
568
|
+
facadeModuleId: item.facadeModuleId || void 0,
|
|
569
|
+
isDynamicEntry: item.isDynamicEntry,
|
|
570
|
+
moduleIds: item.moduleIds,
|
|
571
|
+
map: bindingifySourcemap(item.map),
|
|
572
|
+
sourcemapFilename: item.sourcemapFileName || void 0,
|
|
573
|
+
preliminaryFilename: item.preliminaryFileName
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
return {
|
|
577
|
+
changes,
|
|
578
|
+
deleted: changed.deleted
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
|
|
28
582
|
//#endregion
|
|
29
583
|
//#region src/utils/error.ts
|
|
30
584
|
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
|
|
@@ -135,7 +689,7 @@ function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
|
|
|
135
689
|
//#endregion
|
|
136
690
|
//#region ../../node_modules/.pnpm/remeda@2.33.1/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
|
|
137
691
|
function e(e, t$2, n$1) {
|
|
138
|
-
let r = (n$
|
|
692
|
+
let r = (n$1) => e(n$1, ...t$2);
|
|
139
693
|
return n$1 === void 0 ? r : Object.assign(r, {
|
|
140
694
|
lazy: n$1,
|
|
141
695
|
lazyArgs: t$2
|
|
@@ -468,16 +1022,16 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
|
|
|
468
1022
|
this.inner = inner;
|
|
469
1023
|
this.moduleId = moduleId;
|
|
470
1024
|
this.moduleSource = moduleSource;
|
|
471
|
-
const getLogHandler = (handler) => (log, pos) => {
|
|
1025
|
+
const getLogHandler$1 = (handler) => (log, pos) => {
|
|
472
1026
|
log = normalizeLog(log);
|
|
473
1027
|
if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
|
|
474
1028
|
log.id = moduleId;
|
|
475
1029
|
log.hook = "transform";
|
|
476
1030
|
handler(log);
|
|
477
1031
|
};
|
|
478
|
-
this.debug = getLogHandler(this.debug);
|
|
479
|
-
this.warn = getLogHandler(this.warn);
|
|
480
|
-
this.info = getLogHandler(this.info);
|
|
1032
|
+
this.debug = getLogHandler$1(this.debug);
|
|
1033
|
+
this.warn = getLogHandler$1(this.warn);
|
|
1034
|
+
this.info = getLogHandler$1(this.info);
|
|
481
1035
|
}
|
|
482
1036
|
error(e$1, pos) {
|
|
483
1037
|
if (typeof e$1 === "string") e$1 = { message: e$1 };
|
|
@@ -593,9 +1147,9 @@ function bindingifyTransform(args) {
|
|
|
593
1147
|
if (!hook) return {};
|
|
594
1148
|
const { handler, meta, options } = normalizeHook(hook);
|
|
595
1149
|
return {
|
|
596
|
-
plugin: async (ctx, code, id, meta
|
|
1150
|
+
plugin: async (ctx, code, id, meta) => {
|
|
597
1151
|
let magicStringInstance, astInstance;
|
|
598
|
-
Object.defineProperties(meta
|
|
1152
|
+
Object.defineProperties(meta, {
|
|
599
1153
|
magicString: { get() {
|
|
600
1154
|
if (magicStringInstance) return magicStringInstance;
|
|
601
1155
|
magicStringInstance = new import_binding.BindingMagicString(code);
|
|
@@ -604,24 +1158,24 @@ function bindingifyTransform(args) {
|
|
|
604
1158
|
ast: { get() {
|
|
605
1159
|
if (astInstance) return astInstance;
|
|
606
1160
|
let lang = "js";
|
|
607
|
-
switch (meta
|
|
1161
|
+
switch (meta.moduleType) {
|
|
608
1162
|
case "js":
|
|
609
1163
|
case "jsx":
|
|
610
1164
|
case "ts":
|
|
611
1165
|
case "tsx":
|
|
612
|
-
lang = meta
|
|
1166
|
+
lang = meta.moduleType;
|
|
613
1167
|
break;
|
|
614
1168
|
default: break;
|
|
615
1169
|
}
|
|
616
1170
|
astInstance = parseAst(code, {
|
|
617
|
-
astType: meta
|
|
1171
|
+
astType: meta.moduleType.includes("ts") ? "ts" : "js",
|
|
618
1172
|
lang
|
|
619
1173
|
});
|
|
620
1174
|
return astInstance;
|
|
621
1175
|
} }
|
|
622
1176
|
});
|
|
623
1177
|
const transformCtx = new TransformPluginContextImpl(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id, code, args.onLog, args.logLevel, args.watchMode);
|
|
624
|
-
const ret = await handler.call(transformCtx, code, id, meta
|
|
1178
|
+
const ret = await handler.call(transformCtx, code, id, meta);
|
|
625
1179
|
if (ret == null) return;
|
|
626
1180
|
if (typeof ret === "string") return { code: ret };
|
|
627
1181
|
let moduleOption = args.pluginContextData.updateModuleOption(id, {
|
|
@@ -715,8 +1269,8 @@ function bindingifyRenderChunk(args) {
|
|
|
715
1269
|
if (!hook) return {};
|
|
716
1270
|
const { handler, meta, options } = normalizeHook(hook);
|
|
717
1271
|
return {
|
|
718
|
-
plugin: async (ctx, code, chunk, opts, meta
|
|
719
|
-
if (args.pluginContextData.getRenderChunkMeta() == null) args.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta
|
|
1272
|
+
plugin: async (ctx, code, chunk, opts, meta) => {
|
|
1273
|
+
if (args.pluginContextData.getRenderChunkMeta() == null) args.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
|
|
720
1274
|
const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), code, transformRenderedChunk(chunk), args.pluginContextData.getOutputOptions(opts), args.pluginContextData.getRenderChunkMeta());
|
|
721
1275
|
if (ret == null) return;
|
|
722
1276
|
if (typeof ret === "string") return { code: ret };
|
|
@@ -1395,8 +1949,6 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
1395
1949
|
const plugins = rawPlugins.map((plugin) => {
|
|
1396
1950
|
if ("_parallel" in plugin) return;
|
|
1397
1951
|
if (plugin instanceof BuiltinPlugin) switch (plugin.name) {
|
|
1398
|
-
case "builtin:vite-css-post": return bindingifyCSSPostPlugin(plugin, pluginContextData);
|
|
1399
|
-
case "builtin:vite-html": return bindingifyViteHtmlPlugin(plugin, onLog, logLevel, watchMode, pluginContextData);
|
|
1400
1952
|
case "builtin:vite-manifest": return bindingifyManifestPlugin(plugin, pluginContextData);
|
|
1401
1953
|
default: return bindingifyBuiltInPlugin(plugin);
|
|
1402
1954
|
}
|
|
@@ -1619,4 +2171,4 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
|
|
|
1619
2171
|
}
|
|
1620
2172
|
|
|
1621
2173
|
//#endregion
|
|
1622
|
-
export { aggregateBindingErrorsIntoJsError as a,
|
|
2174
|
+
export { description as C, VERSION as S, LOG_LEVEL_DEBUG as _, aggregateBindingErrorsIntoJsError as a, LOG_LEVEL_WARN as b, transformToRollupOutput as c, transformAssetSource as d, lazyProp as f, normalizeLog as g, normalizeHook as h, transformModuleInfo as i, transformRenderedChunk as l, MinimalPluginContextImpl as m, PluginContextData as n, normalizeBindingResult as o, PlainObjectLike as p, bindingifyPlugin as r, unwrapBindingResult as s, bindingifyInputOptions as t, __decorate as u, LOG_LEVEL_ERROR as v, version as w, logLevelPriority as x, LOG_LEVEL_INFO as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-CYnwzi7f.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/builtin-plugin/constructors.ts
|
|
4
4
|
function viteModulePreloadPolyfillPlugin(config) {
|
|
@@ -56,12 +56,6 @@ function viteReactRefreshWrapperPlugin(config) {
|
|
|
56
56
|
}
|
|
57
57
|
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-react-refresh-wrapper", config));
|
|
58
58
|
}
|
|
59
|
-
function viteHtmlInlineProxyPlugin(config) {
|
|
60
|
-
return new BuiltinPlugin("builtin:vite-html-inline-proxy", config);
|
|
61
|
-
}
|
|
62
|
-
function viteAssetImportMetaUrlPlugin(config) {
|
|
63
|
-
return new BuiltinPlugin("builtin:vite-asset-import-meta-url", config);
|
|
64
|
-
}
|
|
65
59
|
|
|
66
60
|
//#endregion
|
|
67
|
-
export {
|
|
61
|
+
export { viteImportGlobPlugin as a, viteModulePreloadPolyfillPlugin as c, viteResolvePlugin as d, viteWasmFallbackPlugin as f, viteDynamicImportVarsPlugin as i, viteReactRefreshWrapperPlugin as l, viteWebWorkerPostPlugin as m, isolatedDeclarationPlugin as n, viteJsonPlugin as o, viteWasmHelperPlugin as p, viteBuildImportAnalysisPlugin as r, viteLoadFallbackPlugin as s, esmExternalRequirePlugin as t, viteReporterPlugin as u };
|