rolldown 0.14.0-snapshot-b676fe3-20241118003551 → 0.14.0-snapshot-ae73254-20241120003454
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/cjs/cli.cjs +1 -1
- package/dist/cjs/experimental-index.cjs +4 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/parallel-plugin-worker.cjs +1 -1
- package/dist/esm/cli.mjs +1 -1
- package/dist/esm/experimental-index.mjs +2 -2
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/parallel-plugin-worker.mjs +1 -1
- package/dist/shared/rolldown-binding.wasi.cjs +45 -29
- package/dist/shared/{src_index-TPOcVtuZ.cjs → src_index-Yt-qn7mE.cjs} +120 -29
- package/dist/shared/{src_index-BcFJfRrY.mjs → src_index-k_6h6jvv.mjs} +118 -30
- package/dist/types/binding.d.ts +55 -2
- package/dist/types/experimental-index.d.ts +1 -1
- package/dist/types/plugin/builtin-plugin.d.ts +10 -1
- package/dist/types/plugin/plugin-context-data.d.ts +1 -0
- package/package.json +14 -14
package/dist/cjs/cli.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const { __export, __toESM } = require("../shared/chunk-JoMxl5V2.cjs");
|
|
4
|
-
const { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, TreeshakingOptionsSchema, arraify, description, rolldown, version, watch } = require("../shared/src_index-
|
|
4
|
+
const { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, TreeshakingOptionsSchema, arraify, description, rolldown, version, watch } = require("../shared/src_index-Yt-qn7mE.cjs");
|
|
5
5
|
const { createConsola } = require("../shared/consola.36c0034f-HcmWcfPe.cjs");
|
|
6
6
|
const { default: nodePath, default: path } = __toESM(require("node:path"));
|
|
7
7
|
const { ZodFirstPartyTypeKind, ZodFirstPartyTypeKind: ZodFirstPartyTypeKind$1, ZodFirstPartyTypeKind: ZodFirstPartyTypeKind$2, z, z: z$1, z: z$2, z: z$3 } = __toESM(require("zod"));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const { __toESM } = require("../shared/chunk-JoMxl5V2.cjs");
|
|
4
|
-
const { aliasPlugin, buildImportAnalysisPlugin, composeJsPlugins, dynamicImportVarsPlugin, experimental_scan, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, replacePlugin, require_binding, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } = require("../shared/src_index-
|
|
4
|
+
const { aliasPlugin, buildImportAnalysisPlugin, composeJsPlugins, dynamicImportVarsPlugin, experimental_scan, importGlobPlugin, isCallableBuiltinPlugin, isCallableCompatibleBuiltinPlugin, jsonPlugin, loadFallbackPlugin, makeBuiltinPluginCallable, manifestPlugin, modulePreloadPolyfillPlugin, replacePlugin, require_binding, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } = require("../shared/src_index-Yt-qn7mE.cjs");
|
|
5
5
|
const { pathToFileURL } = __toESM(require("node:url"));
|
|
6
6
|
|
|
7
7
|
//#region src/plugin/parallel-plugin.ts
|
|
@@ -27,8 +27,11 @@ exports.composePlugins = composeJsPlugins;
|
|
|
27
27
|
exports.defineParallelPlugin = defineParallelPlugin;
|
|
28
28
|
exports.dynamicImportVarsPlugin = dynamicImportVarsPlugin;
|
|
29
29
|
exports.importGlobPlugin = importGlobPlugin;
|
|
30
|
+
exports.isCallableBuiltinPlugin = isCallableBuiltinPlugin;
|
|
31
|
+
exports.isCallableCompatibleBuiltinPlugin = isCallableCompatibleBuiltinPlugin;
|
|
30
32
|
exports.jsonPlugin = jsonPlugin;
|
|
31
33
|
exports.loadFallbackPlugin = loadFallbackPlugin;
|
|
34
|
+
exports.makeBuiltinPluginCallable = makeBuiltinPluginCallable;
|
|
32
35
|
exports.manifestPlugin = manifestPlugin;
|
|
33
36
|
exports.modulePreloadPolyfillPlugin = modulePreloadPolyfillPlugin;
|
|
34
37
|
exports.replacePlugin = replacePlugin;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const { VERSION, defineConfig, rolldown, watch } = require("../shared/src_index-
|
|
3
|
+
const { VERSION, defineConfig, rolldown, watch } = require("../shared/src_index-Yt-qn7mE.cjs");
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6
6
|
exports.VERSION = VERSION;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const { __toESM } = require("../shared/chunk-JoMxl5V2.cjs");
|
|
4
|
-
const { PluginContextData, bindingifyPlugin, require_binding } = require("../shared/src_index-
|
|
4
|
+
const { PluginContextData, bindingifyPlugin, require_binding } = require("../shared/src_index-Yt-qn7mE.cjs");
|
|
5
5
|
const { parentPort, workerData } = __toESM(require("node:worker_threads"));
|
|
6
6
|
|
|
7
7
|
//#region src/parallel-plugin-worker.ts
|
package/dist/esm/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import __node_module__ from 'node:module';
|
|
2
2
|
const require = __node_module__.createRequire(import.meta.url)
|
|
3
|
-
import { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, TreeshakingOptionsSchema, __export, arraify, description, rolldown, version, watch } from "../shared/src_index-
|
|
3
|
+
import { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, TreeshakingOptionsSchema, __export, arraify, description, rolldown, version, watch } from "../shared/src_index-k_6h6jvv.mjs";
|
|
4
4
|
import { createConsola } from "../shared/consola.36c0034f-Xyw7SC_7.mjs";
|
|
5
5
|
import { default as nodePath, default as path } from "node:path";
|
|
6
6
|
import { ZodFirstPartyTypeKind, ZodFirstPartyTypeKind as ZodFirstPartyTypeKind$1, ZodFirstPartyTypeKind as ZodFirstPartyTypeKind$2, z, z as z$1, z as z$2, z as z$3 } from "zod";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import __node_module__ from 'node:module';
|
|
2
2
|
const require = __node_module__.createRequire(import.meta.url)
|
|
3
|
-
import { __toESM, aliasPlugin, buildImportAnalysisPlugin, composeJsPlugins, dynamicImportVarsPlugin, experimental_scan, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, replacePlugin, require_binding, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src_index-
|
|
3
|
+
import { __toESM, aliasPlugin, buildImportAnalysisPlugin, composeJsPlugins, dynamicImportVarsPlugin, experimental_scan, importGlobPlugin, isCallableBuiltinPlugin, isCallableCompatibleBuiltinPlugin, jsonPlugin, loadFallbackPlugin, makeBuiltinPluginCallable, manifestPlugin, modulePreloadPolyfillPlugin, replacePlugin, require_binding, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src_index-k_6h6jvv.mjs";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
|
|
6
6
|
//#region src/plugin/parallel-plugin.ts
|
|
@@ -19,4 +19,4 @@ var import_binding = __toESM(require_binding());
|
|
|
19
19
|
|
|
20
20
|
//#endregion
|
|
21
21
|
var transform = import_binding.transform;
|
|
22
|
-
export { aliasPlugin, buildImportAnalysisPlugin, composeJsPlugins as composePlugins, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, replacePlugin, experimental_scan as scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin };
|
|
22
|
+
export { aliasPlugin, buildImportAnalysisPlugin, composeJsPlugins as composePlugins, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, isCallableBuiltinPlugin, isCallableCompatibleBuiltinPlugin, jsonPlugin, loadFallbackPlugin, makeBuiltinPluginCallable, manifestPlugin, modulePreloadPolyfillPlugin, replacePlugin, experimental_scan as scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import __node_module__ from 'node:module';
|
|
2
2
|
const require = __node_module__.createRequire(import.meta.url)
|
|
3
|
-
import { VERSION, defineConfig, rolldown, watch } from "../shared/src_index-
|
|
3
|
+
import { VERSION, defineConfig, rolldown, watch } from "../shared/src_index-k_6h6jvv.mjs";
|
|
4
4
|
|
|
5
5
|
export { VERSION, defineConfig, rolldown, watch };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import __node_module__ from 'node:module';
|
|
2
2
|
const require = __node_module__.createRequire(import.meta.url)
|
|
3
|
-
import { PluginContextData, __toESM, bindingifyPlugin, require_binding } from "../shared/src_index-
|
|
3
|
+
import { PluginContextData, __toESM, bindingifyPlugin, require_binding } from "../shared/src_index-k_6h6jvv.mjs";
|
|
4
4
|
import { parentPort, workerData } from "node:worker_threads";
|
|
5
5
|
|
|
6
6
|
//#region src/parallel-plugin-worker.ts
|
|
@@ -141,36 +141,49 @@ function __napi_rs_initialize_modules(__napiInstance) {
|
|
|
141
141
|
__napiInstance.exports['__napi_register__BindingViteResolvePluginConfig_struct_59']?.()
|
|
142
142
|
__napiInstance.exports['__napi_register__BindingViteResolvePluginResolveOptions_struct_60']?.()
|
|
143
143
|
__napiInstance.exports['__napi_register__BindingReplacePluginConfig_struct_61']?.()
|
|
144
|
-
__napiInstance.exports['
|
|
145
|
-
__napiInstance.exports['
|
|
146
|
-
__napiInstance.exports['
|
|
147
|
-
__napiInstance.exports['
|
|
148
|
-
__napiInstance.exports['
|
|
149
|
-
__napiInstance.exports['
|
|
150
|
-
__napiInstance.exports['
|
|
151
|
-
__napiInstance.exports['
|
|
152
|
-
__napiInstance.exports['
|
|
153
|
-
__napiInstance.exports['
|
|
154
|
-
__napiInstance.exports['
|
|
155
|
-
__napiInstance.exports['
|
|
156
|
-
__napiInstance.exports['
|
|
157
|
-
__napiInstance.exports['
|
|
158
|
-
__napiInstance.exports['
|
|
159
|
-
__napiInstance.exports['
|
|
160
|
-
__napiInstance.exports['
|
|
161
|
-
__napiInstance.exports['
|
|
162
|
-
__napiInstance.exports['
|
|
163
|
-
__napiInstance.exports['
|
|
164
|
-
__napiInstance.exports['
|
|
165
|
-
__napiInstance.exports['
|
|
166
|
-
__napiInstance.exports['
|
|
167
|
-
__napiInstance.exports['
|
|
168
|
-
__napiInstance.exports['
|
|
169
|
-
__napiInstance.exports['
|
|
170
|
-
__napiInstance.exports['
|
|
171
|
-
__napiInstance.exports['
|
|
172
|
-
__napiInstance.exports['
|
|
144
|
+
__napiInstance.exports['__napi_register__is_callable_compatible_builtin_plugin_62']?.()
|
|
145
|
+
__napiInstance.exports['__napi_register__BindingCallableBuiltinPlugin_struct_63']?.()
|
|
146
|
+
__napiInstance.exports['__napi_register__BindingCallableBuiltinPlugin_impl_68']?.()
|
|
147
|
+
__napiInstance.exports['__napi_register__BindingHookJsResolveIdOptions_struct_69']?.()
|
|
148
|
+
__napiInstance.exports['__napi_register__BindingHookJsResolveIdOutput_struct_70']?.()
|
|
149
|
+
__napiInstance.exports['__napi_register__BindingHookJsLoadOutput_struct_71']?.()
|
|
150
|
+
__napiInstance.exports['__napi_register__BindingJsWatchChangeEvent_struct_72']?.()
|
|
151
|
+
__napiInstance.exports['__napi_register__BindingPluginOrder_73']?.()
|
|
152
|
+
__napiInstance.exports['__napi_register__BindingPluginHookMeta_struct_74']?.()
|
|
153
|
+
__napiInstance.exports['__napi_register__ParallelJsPluginRegistry_struct_75']?.()
|
|
154
|
+
__napiInstance.exports['__napi_register__ParallelJsPluginRegistry_impl_77']?.()
|
|
155
|
+
__napiInstance.exports['__napi_register__register_plugins_78']?.()
|
|
156
|
+
__napiInstance.exports['__napi_register__BindingLog_struct_79']?.()
|
|
157
|
+
__napiInstance.exports['__napi_register__BindingLogLevel_80']?.()
|
|
158
|
+
__napiInstance.exports['__napi_register__BindingModuleInfo_struct_81']?.()
|
|
159
|
+
__napiInstance.exports['__napi_register__BindingModuleInfo_impl_83']?.()
|
|
160
|
+
__napiInstance.exports['__napi_register__BindingOutputAsset_struct_84']?.()
|
|
161
|
+
__napiInstance.exports['__napi_register__BindingOutputAsset_impl_89']?.()
|
|
162
|
+
__napiInstance.exports['__napi_register__JsOutputAsset_struct_90']?.()
|
|
163
|
+
__napiInstance.exports['__napi_register__BindingOutputChunk_struct_91']?.()
|
|
164
|
+
__napiInstance.exports['__napi_register__BindingOutputChunk_impl_106']?.()
|
|
165
|
+
__napiInstance.exports['__napi_register__JsOutputChunk_struct_107']?.()
|
|
166
|
+
__napiInstance.exports['__napi_register__BindingOutputs_struct_108']?.()
|
|
167
|
+
__napiInstance.exports['__napi_register__BindingOutputs_impl_112']?.()
|
|
168
|
+
__napiInstance.exports['__napi_register__JsChangedOutputs_struct_113']?.()
|
|
169
|
+
__napiInstance.exports['__napi_register__PreRenderedChunk_struct_114']?.()
|
|
170
|
+
__napiInstance.exports['__napi_register__RenderedChunk_struct_115']?.()
|
|
171
|
+
__napiInstance.exports['__napi_register__BindingRenderedModule_struct_116']?.()
|
|
172
|
+
__napiInstance.exports['__napi_register__BindingRenderedModule_impl_118']?.()
|
|
173
|
+
__napiInstance.exports['__napi_register__AliasItem_struct_119']?.()
|
|
174
|
+
__napiInstance.exports['__napi_register__ExtensionAliasItem_struct_120']?.()
|
|
175
|
+
__napiInstance.exports['__napi_register__BindingSourcemap_struct_121']?.()
|
|
176
|
+
__napiInstance.exports['__napi_register__BindingJsonSourcemap_struct_122']?.()
|
|
177
|
+
__napiInstance.exports['__napi_register__BindingWatcher_struct_123']?.()
|
|
178
|
+
__napiInstance.exports['__napi_register__BindingWatcher_impl_127']?.()
|
|
179
|
+
__napiInstance.exports['__napi_register__BindingWatcherEvent_128']?.()
|
|
180
|
+
__napiInstance.exports['__napi_register__BindingWatcherEventData_struct_129']?.()
|
|
181
|
+
__napiInstance.exports['__napi_register__BindingWatcherEventData_impl_134']?.()
|
|
182
|
+
__napiInstance.exports['__napi_register__BindingWatcherChangeData_struct_135']?.()
|
|
183
|
+
__napiInstance.exports['__napi_register__BindingBundleEndEventData_struct_136']?.()
|
|
173
184
|
}
|
|
185
|
+
module.exports.BindingBundleEndEventData = __napiModule.exports.BindingBundleEndEventData
|
|
186
|
+
module.exports.BindingCallableBuiltinPlugin = __napiModule.exports.BindingCallableBuiltinPlugin
|
|
174
187
|
module.exports.BindingLog = __napiModule.exports.BindingLog
|
|
175
188
|
module.exports.BindingModuleInfo = __napiModule.exports.BindingModuleInfo
|
|
176
189
|
module.exports.BindingOutputAsset = __napiModule.exports.BindingOutputAsset
|
|
@@ -180,6 +193,8 @@ module.exports.BindingPluginContext = __napiModule.exports.BindingPluginContext
|
|
|
180
193
|
module.exports.BindingRenderedModule = __napiModule.exports.BindingRenderedModule
|
|
181
194
|
module.exports.BindingTransformPluginContext = __napiModule.exports.BindingTransformPluginContext
|
|
182
195
|
module.exports.BindingWatcher = __napiModule.exports.BindingWatcher
|
|
196
|
+
module.exports.BindingWatcherChangeData = __napiModule.exports.BindingWatcherChangeData
|
|
197
|
+
module.exports.BindingWatcherEventData = __napiModule.exports.BindingWatcherEventData
|
|
183
198
|
module.exports.Bundler = __napiModule.exports.Bundler
|
|
184
199
|
module.exports.ParallelJsPluginRegistry = __napiModule.exports.ParallelJsPluginRegistry
|
|
185
200
|
module.exports.BindingBuiltinPluginName = __napiModule.exports.BindingBuiltinPluginName
|
|
@@ -187,6 +202,7 @@ module.exports.BindingHookSideEffects = __napiModule.exports.BindingHookSideEffe
|
|
|
187
202
|
module.exports.BindingLogLevel = __napiModule.exports.BindingLogLevel
|
|
188
203
|
module.exports.BindingPluginOrder = __napiModule.exports.BindingPluginOrder
|
|
189
204
|
module.exports.BindingWatcherEvent = __napiModule.exports.BindingWatcherEvent
|
|
205
|
+
module.exports.isCallableCompatibleBuiltinPlugin = __napiModule.exports.isCallableCompatibleBuiltinPlugin
|
|
190
206
|
module.exports.isolatedDeclaration = __napiModule.exports.isolatedDeclaration
|
|
191
207
|
module.exports.registerPlugins = __napiModule.exports.registerPlugins
|
|
192
208
|
module.exports.transform = __napiModule.exports.transform
|
|
@@ -132,8 +132,7 @@ function handleOutputErrors(output) {
|
|
|
132
132
|
summary += "\n...";
|
|
133
133
|
break;
|
|
134
134
|
}
|
|
135
|
-
|
|
136
|
-
summary += (e.stack ?? e.message) + "\n";
|
|
135
|
+
summary += getErrorMessage(errors[i]) + "\n";
|
|
137
136
|
}
|
|
138
137
|
const wrapper = new Error(summary);
|
|
139
138
|
Object.defineProperty(wrapper, "errors", {
|
|
@@ -149,6 +148,34 @@ function handleOutputErrors(output) {
|
|
|
149
148
|
throw wrapper;
|
|
150
149
|
}
|
|
151
150
|
}
|
|
151
|
+
function getErrorMessage(e) {
|
|
152
|
+
let s = "";
|
|
153
|
+
if (e.plugin) {
|
|
154
|
+
s += `[plugin ${e.plugin}]`;
|
|
155
|
+
}
|
|
156
|
+
const id = e.id ?? e.loc?.file;
|
|
157
|
+
if (id) {
|
|
158
|
+
s += " " + id;
|
|
159
|
+
if (e.loc) {
|
|
160
|
+
s += `:${e.loc.line}:${e.loc.column}`;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (s) {
|
|
164
|
+
s += "\n";
|
|
165
|
+
}
|
|
166
|
+
const message = `${e.name ?? "Error"}: ${e.message}`;
|
|
167
|
+
s += message;
|
|
168
|
+
if (e.frame) {
|
|
169
|
+
s = joinNewLine(s, e.frame);
|
|
170
|
+
}
|
|
171
|
+
if (e.stack) {
|
|
172
|
+
s = joinNewLine(s, e.stack.replace(message, ""));
|
|
173
|
+
}
|
|
174
|
+
return s;
|
|
175
|
+
}
|
|
176
|
+
function joinNewLine(s1, s2) {
|
|
177
|
+
return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
|
|
178
|
+
}
|
|
152
179
|
function transformToOutputBundle(output, changed) {
|
|
153
180
|
const bundle = Object.fromEntries((transformToRollupOutput(output, changed)).output.map((item) => [item.fileName, item,]));
|
|
154
181
|
return new Proxy(bundle, {deleteProperty(target, property) {
|
|
@@ -527,6 +554,8 @@ var require_binding = __commonJSMin((exports, module) => {
|
|
|
527
554
|
}
|
|
528
555
|
throw new Error(`Failed to load native binding`);
|
|
529
556
|
}
|
|
557
|
+
module.exports.BindingBundleEndEventData = nativeBinding.BindingBundleEndEventData;
|
|
558
|
+
module.exports.BindingCallableBuiltinPlugin = nativeBinding.BindingCallableBuiltinPlugin;
|
|
530
559
|
module.exports.BindingLog = nativeBinding.BindingLog;
|
|
531
560
|
module.exports.BindingModuleInfo = nativeBinding.BindingModuleInfo;
|
|
532
561
|
module.exports.BindingOutputAsset = nativeBinding.BindingOutputAsset;
|
|
@@ -536,6 +565,8 @@ var require_binding = __commonJSMin((exports, module) => {
|
|
|
536
565
|
module.exports.BindingRenderedModule = nativeBinding.BindingRenderedModule;
|
|
537
566
|
module.exports.BindingTransformPluginContext = nativeBinding.BindingTransformPluginContext;
|
|
538
567
|
module.exports.BindingWatcher = nativeBinding.BindingWatcher;
|
|
568
|
+
module.exports.BindingWatcherChangeData = nativeBinding.BindingWatcherChangeData;
|
|
569
|
+
module.exports.BindingWatcherEventData = nativeBinding.BindingWatcherEventData;
|
|
539
570
|
module.exports.Bundler = nativeBinding.Bundler;
|
|
540
571
|
module.exports.ParallelJsPluginRegistry = nativeBinding.ParallelJsPluginRegistry;
|
|
541
572
|
module.exports.BindingBuiltinPluginName = nativeBinding.BindingBuiltinPluginName;
|
|
@@ -543,6 +574,7 @@ var require_binding = __commonJSMin((exports, module) => {
|
|
|
543
574
|
module.exports.BindingLogLevel = nativeBinding.BindingLogLevel;
|
|
544
575
|
module.exports.BindingPluginOrder = nativeBinding.BindingPluginOrder;
|
|
545
576
|
module.exports.BindingWatcherEvent = nativeBinding.BindingWatcherEvent;
|
|
577
|
+
module.exports.isCallableCompatibleBuiltinPlugin = nativeBinding.isCallableCompatibleBuiltinPlugin;
|
|
546
578
|
module.exports.isolatedDeclaration = nativeBinding.isolatedDeclaration;
|
|
547
579
|
module.exports.registerPlugins = nativeBinding.registerPlugins;
|
|
548
580
|
module.exports.transform = nativeBinding.transform;
|
|
@@ -962,6 +994,26 @@ function replacePlugin(values = {}, options = {}) {
|
|
|
962
994
|
values
|
|
963
995
|
});
|
|
964
996
|
}
|
|
997
|
+
function isCallableCompatibleBuiltinPlugin(plugin) {
|
|
998
|
+
return plugin instanceof BuiltinPlugin && (0, import_binding$6.isCallableCompatibleBuiltinPlugin)(bindingifyBuiltInPlugin(plugin));
|
|
999
|
+
}
|
|
1000
|
+
function makeBuiltinPluginCallable(plugin) {
|
|
1001
|
+
let callablePlugin = new import_binding$6.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
1002
|
+
const wrappedPlugin = {_original: callablePlugin};
|
|
1003
|
+
for (const key in callablePlugin) {
|
|
1004
|
+
if (key === "name") {
|
|
1005
|
+
wrappedPlugin[key] = callablePlugin[key];
|
|
1006
|
+
} else {
|
|
1007
|
+
wrappedPlugin[key] = function(...args) {
|
|
1008
|
+
return callablePlugin[key](...args);
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
return wrappedPlugin;
|
|
1013
|
+
}
|
|
1014
|
+
function isCallableBuiltinPlugin(plugin) {
|
|
1015
|
+
return "_original"in plugin && plugin._original instanceof import_binding$6.BindingCallableBuiltinPlugin;
|
|
1016
|
+
}
|
|
965
1017
|
function bindingifyBuiltInPlugin(plugin) {
|
|
966
1018
|
return {
|
|
967
1019
|
__name: plugin.name,
|
|
@@ -1172,6 +1224,20 @@ function relativeId(id) {
|
|
|
1172
1224
|
return path$1.relative(path$1.resolve(), id);
|
|
1173
1225
|
}
|
|
1174
1226
|
|
|
1227
|
+
//#endregion
|
|
1228
|
+
//#region src/utils/transform-side-effects.ts
|
|
1229
|
+
var import_binding$5 = __toESM(require_binding());
|
|
1230
|
+
function bindingifySideEffects(sideEffects) {
|
|
1231
|
+
switch (sideEffects) {
|
|
1232
|
+
case true: return import_binding$5.BindingHookSideEffects.True;
|
|
1233
|
+
case false: return import_binding$5.BindingHookSideEffects.False;
|
|
1234
|
+
case "no-treeshake": return import_binding$5.BindingHookSideEffects.NoTreeshake;
|
|
1235
|
+
case null:
|
|
1236
|
+
case undefined: return undefined;
|
|
1237
|
+
default: throw new Error(`Unexpected side effects: ${sideEffects}`);
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1175
1241
|
//#endregion
|
|
1176
1242
|
//#region src/plugin/plugin-context.ts
|
|
1177
1243
|
class PluginContext extends MinimalPluginContext {
|
|
@@ -1195,12 +1261,24 @@ class PluginContext extends MinimalPluginContext {
|
|
|
1195
1261
|
moduleSideEffects: options$1.moduleSideEffects || null
|
|
1196
1262
|
};
|
|
1197
1263
|
data.updateModuleOption(id, rawOptions);
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1264
|
+
async function createLoadModulePromise() {
|
|
1265
|
+
const loadPromise = data.loadModulePromiseMap.get(id);
|
|
1266
|
+
if (loadPromise) {
|
|
1267
|
+
return loadPromise;
|
|
1268
|
+
}
|
|
1269
|
+
let resolveFn;
|
|
1270
|
+
const promise = new Promise((resolve, _) => {
|
|
1271
|
+
resolveFn = resolve;
|
|
1272
|
+
});
|
|
1273
|
+
data.loadModulePromiseMap.set(id, promise);
|
|
1274
|
+
try {
|
|
1275
|
+
await context.load(id, bindingifySideEffects(options$1.moduleSideEffects), resolveFn);
|
|
1276
|
+
} finally {
|
|
1277
|
+
data.loadModulePromiseMap.delete(id);
|
|
1278
|
+
}
|
|
1279
|
+
return promise;
|
|
1280
|
+
}
|
|
1281
|
+
await createLoadModulePromise();
|
|
1204
1282
|
return data.getModuleInfo(id, context);
|
|
1205
1283
|
};
|
|
1206
1284
|
this.resolve = async (source, importer, options$1) => {
|
|
@@ -1266,20 +1344,6 @@ class TransformPluginContext extends PluginContext {
|
|
|
1266
1344
|
}
|
|
1267
1345
|
}
|
|
1268
1346
|
|
|
1269
|
-
//#endregion
|
|
1270
|
-
//#region src/utils/transform-side-effects.ts
|
|
1271
|
-
var import_binding$5 = __toESM(require_binding());
|
|
1272
|
-
function bindingifySideEffects(sideEffects) {
|
|
1273
|
-
switch (sideEffects) {
|
|
1274
|
-
case true: return import_binding$5.BindingHookSideEffects.True;
|
|
1275
|
-
case false: return import_binding$5.BindingHookSideEffects.False;
|
|
1276
|
-
case "no-treeshake": return import_binding$5.BindingHookSideEffects.NoTreeshake;
|
|
1277
|
-
case null:
|
|
1278
|
-
case undefined: return undefined;
|
|
1279
|
-
default: throw new Error(`Unexpected side effects: ${sideEffects}`);
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
1347
|
//#endregion
|
|
1284
1348
|
//#region src/plugin/bindingify-plugin-hook-meta.ts
|
|
1285
1349
|
var import_binding$4 = __toESM(require_binding());
|
|
@@ -1779,7 +1843,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData) {
|
|
|
1779
1843
|
const { plugin: outro, meta: outroMeta } = bindingifyOutro(plugin, options, pluginContextData);
|
|
1780
1844
|
const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(plugin, options, pluginContextData);
|
|
1781
1845
|
const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(plugin, options, pluginContextData);
|
|
1782
|
-
|
|
1846
|
+
const result = {
|
|
1783
1847
|
name: plugin.name ?? "unknown",
|
|
1784
1848
|
buildStart,
|
|
1785
1849
|
buildStartMeta,
|
|
@@ -1825,6 +1889,25 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData) {
|
|
|
1825
1889
|
closeWatcher,
|
|
1826
1890
|
closeWatcherMeta
|
|
1827
1891
|
};
|
|
1892
|
+
return wrapHandlers(result);
|
|
1893
|
+
}
|
|
1894
|
+
function wrapHandlers(plugin) {
|
|
1895
|
+
for (const hookName of ["buildStart", "resolveId", "resolveDynamicImport", "buildEnd", "transform", "moduleParsed", "load", "renderChunk", "augmentChunkHash", "renderStart", "renderError", "generateBundle", "writeBundle", "closeBundle", "banner", "footer", "intro", "outro", "watchChange", "closeWatcher",]) {
|
|
1896
|
+
const handler = plugin[hookName];
|
|
1897
|
+
if (handler) {
|
|
1898
|
+
plugin[hookName] = async (...args) => {
|
|
1899
|
+
try {
|
|
1900
|
+
return await handler(...args);
|
|
1901
|
+
} catch (e) {
|
|
1902
|
+
return error(logPluginError(e, plugin.name, {
|
|
1903
|
+
hook: hookName,
|
|
1904
|
+
id: hookName === "transform" ? args[2] : undefined
|
|
1905
|
+
}));
|
|
1906
|
+
}
|
|
1907
|
+
};
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
return plugin;
|
|
1828
1911
|
}
|
|
1829
1912
|
|
|
1830
1913
|
//#endregion
|
|
@@ -1832,6 +1915,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData) {
|
|
|
1832
1915
|
class PluginContextData {
|
|
1833
1916
|
moduleOptionMap = new Map();
|
|
1834
1917
|
resolveOptionsMap = new Map();
|
|
1918
|
+
loadModulePromiseMap = new Map();
|
|
1835
1919
|
updateModuleOption(id, option) {
|
|
1836
1920
|
const existing = this.moduleOptionMap.get(id);
|
|
1837
1921
|
if (existing) {
|
|
@@ -2794,22 +2878,24 @@ class Watcher {
|
|
|
2794
2878
|
break;
|
|
2795
2879
|
case "event":
|
|
2796
2880
|
this.inner.on(import_binding.BindingWatcherEvent.Event, async (data) => {
|
|
2797
|
-
|
|
2881
|
+
const code = data.bundleEventKind();
|
|
2882
|
+
switch (code) {
|
|
2798
2883
|
case "BUNDLE_END":
|
|
2884
|
+
const { duration: duration, output: output } = data.bundleEndData();
|
|
2799
2885
|
await listener({
|
|
2800
2886
|
code: "BUNDLE_END",
|
|
2801
|
-
duration
|
|
2802
|
-
output: [
|
|
2887
|
+
duration,
|
|
2888
|
+
output: [output]
|
|
2803
2889
|
});
|
|
2804
2890
|
break;
|
|
2805
2891
|
case "ERROR":
|
|
2806
2892
|
await listener({
|
|
2807
2893
|
code: "ERROR",
|
|
2808
|
-
error: {message: data.error}
|
|
2894
|
+
error: {message: data.error()}
|
|
2809
2895
|
});
|
|
2810
2896
|
break;
|
|
2811
2897
|
default:
|
|
2812
|
-
await listener(
|
|
2898
|
+
await listener({code});
|
|
2813
2899
|
break;
|
|
2814
2900
|
}
|
|
2815
2901
|
});
|
|
@@ -2821,7 +2907,8 @@ class Watcher {
|
|
|
2821
2907
|
break;
|
|
2822
2908
|
case "change":
|
|
2823
2909
|
this.inner.on(import_binding.BindingWatcherEvent.Change, async (data) => {
|
|
2824
|
-
|
|
2910
|
+
const { path: path$2, kind: kind } = data.watchChangeData();
|
|
2911
|
+
await listener(path$2, {event: kind});
|
|
2825
2912
|
});
|
|
2826
2913
|
break;
|
|
2827
2914
|
default: throw new Error(`Unknown event: ${event}`);
|
|
@@ -2833,6 +2920,7 @@ class Watcher {
|
|
|
2833
2920
|
this.controller.signal.addEventListener("abort", () => {
|
|
2834
2921
|
clearInterval(timer);
|
|
2835
2922
|
});
|
|
2923
|
+
process.nextTick(() => this.inner.start());
|
|
2836
2924
|
}
|
|
2837
2925
|
}
|
|
2838
2926
|
|
|
@@ -2883,8 +2971,11 @@ exports.description = description;
|
|
|
2883
2971
|
exports.dynamicImportVarsPlugin = dynamicImportVarsPlugin;
|
|
2884
2972
|
exports.experimental_scan = experimental_scan;
|
|
2885
2973
|
exports.importGlobPlugin = importGlobPlugin;
|
|
2974
|
+
exports.isCallableBuiltinPlugin = isCallableBuiltinPlugin;
|
|
2975
|
+
exports.isCallableCompatibleBuiltinPlugin = isCallableCompatibleBuiltinPlugin;
|
|
2886
2976
|
exports.jsonPlugin = jsonPlugin;
|
|
2887
2977
|
exports.loadFallbackPlugin = loadFallbackPlugin;
|
|
2978
|
+
exports.makeBuiltinPluginCallable = makeBuiltinPluginCallable;
|
|
2888
2979
|
exports.manifestPlugin = manifestPlugin;
|
|
2889
2980
|
exports.modulePreloadPolyfillPlugin = modulePreloadPolyfillPlugin;
|
|
2890
2981
|
exports.replacePlugin = replacePlugin;
|
|
@@ -163,8 +163,7 @@ function handleOutputErrors(output) {
|
|
|
163
163
|
summary += "\n...";
|
|
164
164
|
break;
|
|
165
165
|
}
|
|
166
|
-
|
|
167
|
-
summary += (e.stack ?? e.message) + "\n";
|
|
166
|
+
summary += getErrorMessage(errors[i]) + "\n";
|
|
168
167
|
}
|
|
169
168
|
const wrapper = new Error(summary);
|
|
170
169
|
Object.defineProperty(wrapper, "errors", {
|
|
@@ -180,6 +179,34 @@ function handleOutputErrors(output) {
|
|
|
180
179
|
throw wrapper;
|
|
181
180
|
}
|
|
182
181
|
}
|
|
182
|
+
function getErrorMessage(e) {
|
|
183
|
+
let s = "";
|
|
184
|
+
if (e.plugin) {
|
|
185
|
+
s += `[plugin ${e.plugin}]`;
|
|
186
|
+
}
|
|
187
|
+
const id = e.id ?? e.loc?.file;
|
|
188
|
+
if (id) {
|
|
189
|
+
s += " " + id;
|
|
190
|
+
if (e.loc) {
|
|
191
|
+
s += `:${e.loc.line}:${e.loc.column}`;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (s) {
|
|
195
|
+
s += "\n";
|
|
196
|
+
}
|
|
197
|
+
const message = `${e.name ?? "Error"}: ${e.message}`;
|
|
198
|
+
s += message;
|
|
199
|
+
if (e.frame) {
|
|
200
|
+
s = joinNewLine(s, e.frame);
|
|
201
|
+
}
|
|
202
|
+
if (e.stack) {
|
|
203
|
+
s = joinNewLine(s, e.stack.replace(message, ""));
|
|
204
|
+
}
|
|
205
|
+
return s;
|
|
206
|
+
}
|
|
207
|
+
function joinNewLine(s1, s2) {
|
|
208
|
+
return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
|
|
209
|
+
}
|
|
183
210
|
function transformToOutputBundle(output, changed) {
|
|
184
211
|
const bundle = Object.fromEntries((transformToRollupOutput(output, changed)).output.map((item) => [item.fileName, item,]));
|
|
185
212
|
return new Proxy(bundle, {deleteProperty(target, property) {
|
|
@@ -557,6 +584,8 @@ var require_binding = __commonJSMin((exports, module) => {
|
|
|
557
584
|
}
|
|
558
585
|
throw new Error(`Failed to load native binding`);
|
|
559
586
|
}
|
|
587
|
+
module.exports.BindingBundleEndEventData = nativeBinding.BindingBundleEndEventData;
|
|
588
|
+
module.exports.BindingCallableBuiltinPlugin = nativeBinding.BindingCallableBuiltinPlugin;
|
|
560
589
|
module.exports.BindingLog = nativeBinding.BindingLog;
|
|
561
590
|
module.exports.BindingModuleInfo = nativeBinding.BindingModuleInfo;
|
|
562
591
|
module.exports.BindingOutputAsset = nativeBinding.BindingOutputAsset;
|
|
@@ -566,6 +595,8 @@ var require_binding = __commonJSMin((exports, module) => {
|
|
|
566
595
|
module.exports.BindingRenderedModule = nativeBinding.BindingRenderedModule;
|
|
567
596
|
module.exports.BindingTransformPluginContext = nativeBinding.BindingTransformPluginContext;
|
|
568
597
|
module.exports.BindingWatcher = nativeBinding.BindingWatcher;
|
|
598
|
+
module.exports.BindingWatcherChangeData = nativeBinding.BindingWatcherChangeData;
|
|
599
|
+
module.exports.BindingWatcherEventData = nativeBinding.BindingWatcherEventData;
|
|
569
600
|
module.exports.Bundler = nativeBinding.Bundler;
|
|
570
601
|
module.exports.ParallelJsPluginRegistry = nativeBinding.ParallelJsPluginRegistry;
|
|
571
602
|
module.exports.BindingBuiltinPluginName = nativeBinding.BindingBuiltinPluginName;
|
|
@@ -573,6 +604,7 @@ var require_binding = __commonJSMin((exports, module) => {
|
|
|
573
604
|
module.exports.BindingLogLevel = nativeBinding.BindingLogLevel;
|
|
574
605
|
module.exports.BindingPluginOrder = nativeBinding.BindingPluginOrder;
|
|
575
606
|
module.exports.BindingWatcherEvent = nativeBinding.BindingWatcherEvent;
|
|
607
|
+
module.exports.isCallableCompatibleBuiltinPlugin = nativeBinding.isCallableCompatibleBuiltinPlugin;
|
|
576
608
|
module.exports.isolatedDeclaration = nativeBinding.isolatedDeclaration;
|
|
577
609
|
module.exports.registerPlugins = nativeBinding.registerPlugins;
|
|
578
610
|
module.exports.transform = nativeBinding.transform;
|
|
@@ -992,6 +1024,26 @@ function replacePlugin(values = {}, options = {}) {
|
|
|
992
1024
|
values
|
|
993
1025
|
});
|
|
994
1026
|
}
|
|
1027
|
+
function isCallableCompatibleBuiltinPlugin(plugin) {
|
|
1028
|
+
return plugin instanceof BuiltinPlugin && (0, import_binding$6.isCallableCompatibleBuiltinPlugin)(bindingifyBuiltInPlugin(plugin));
|
|
1029
|
+
}
|
|
1030
|
+
function makeBuiltinPluginCallable(plugin) {
|
|
1031
|
+
let callablePlugin = new import_binding$6.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
1032
|
+
const wrappedPlugin = {_original: callablePlugin};
|
|
1033
|
+
for (const key in callablePlugin) {
|
|
1034
|
+
if (key === "name") {
|
|
1035
|
+
wrappedPlugin[key] = callablePlugin[key];
|
|
1036
|
+
} else {
|
|
1037
|
+
wrappedPlugin[key] = function(...args) {
|
|
1038
|
+
return callablePlugin[key](...args);
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
return wrappedPlugin;
|
|
1043
|
+
}
|
|
1044
|
+
function isCallableBuiltinPlugin(plugin) {
|
|
1045
|
+
return "_original"in plugin && plugin._original instanceof import_binding$6.BindingCallableBuiltinPlugin;
|
|
1046
|
+
}
|
|
995
1047
|
function bindingifyBuiltInPlugin(plugin) {
|
|
996
1048
|
return {
|
|
997
1049
|
__name: plugin.name,
|
|
@@ -1202,6 +1254,20 @@ function relativeId(id) {
|
|
|
1202
1254
|
return path$1.relative(path$1.resolve(), id);
|
|
1203
1255
|
}
|
|
1204
1256
|
|
|
1257
|
+
//#endregion
|
|
1258
|
+
//#region src/utils/transform-side-effects.ts
|
|
1259
|
+
var import_binding$5 = __toESM(require_binding());
|
|
1260
|
+
function bindingifySideEffects(sideEffects) {
|
|
1261
|
+
switch (sideEffects) {
|
|
1262
|
+
case true: return import_binding$5.BindingHookSideEffects.True;
|
|
1263
|
+
case false: return import_binding$5.BindingHookSideEffects.False;
|
|
1264
|
+
case "no-treeshake": return import_binding$5.BindingHookSideEffects.NoTreeshake;
|
|
1265
|
+
case null:
|
|
1266
|
+
case undefined: return undefined;
|
|
1267
|
+
default: throw new Error(`Unexpected side effects: ${sideEffects}`);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1205
1271
|
//#endregion
|
|
1206
1272
|
//#region src/plugin/plugin-context.ts
|
|
1207
1273
|
class PluginContext extends MinimalPluginContext {
|
|
@@ -1225,12 +1291,24 @@ class PluginContext extends MinimalPluginContext {
|
|
|
1225
1291
|
moduleSideEffects: options$1.moduleSideEffects || null
|
|
1226
1292
|
};
|
|
1227
1293
|
data.updateModuleOption(id, rawOptions);
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1294
|
+
async function createLoadModulePromise() {
|
|
1295
|
+
const loadPromise = data.loadModulePromiseMap.get(id);
|
|
1296
|
+
if (loadPromise) {
|
|
1297
|
+
return loadPromise;
|
|
1298
|
+
}
|
|
1299
|
+
let resolveFn;
|
|
1300
|
+
const promise = new Promise((resolve, _) => {
|
|
1301
|
+
resolveFn = resolve;
|
|
1302
|
+
});
|
|
1303
|
+
data.loadModulePromiseMap.set(id, promise);
|
|
1304
|
+
try {
|
|
1305
|
+
await context.load(id, bindingifySideEffects(options$1.moduleSideEffects), resolveFn);
|
|
1306
|
+
} finally {
|
|
1307
|
+
data.loadModulePromiseMap.delete(id);
|
|
1308
|
+
}
|
|
1309
|
+
return promise;
|
|
1310
|
+
}
|
|
1311
|
+
await createLoadModulePromise();
|
|
1234
1312
|
return data.getModuleInfo(id, context);
|
|
1235
1313
|
};
|
|
1236
1314
|
this.resolve = async (source, importer, options$1) => {
|
|
@@ -1296,20 +1374,6 @@ class TransformPluginContext extends PluginContext {
|
|
|
1296
1374
|
}
|
|
1297
1375
|
}
|
|
1298
1376
|
|
|
1299
|
-
//#endregion
|
|
1300
|
-
//#region src/utils/transform-side-effects.ts
|
|
1301
|
-
var import_binding$5 = __toESM(require_binding());
|
|
1302
|
-
function bindingifySideEffects(sideEffects) {
|
|
1303
|
-
switch (sideEffects) {
|
|
1304
|
-
case true: return import_binding$5.BindingHookSideEffects.True;
|
|
1305
|
-
case false: return import_binding$5.BindingHookSideEffects.False;
|
|
1306
|
-
case "no-treeshake": return import_binding$5.BindingHookSideEffects.NoTreeshake;
|
|
1307
|
-
case null:
|
|
1308
|
-
case undefined: return undefined;
|
|
1309
|
-
default: throw new Error(`Unexpected side effects: ${sideEffects}`);
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
1377
|
//#endregion
|
|
1314
1378
|
//#region src/plugin/bindingify-plugin-hook-meta.ts
|
|
1315
1379
|
var import_binding$4 = __toESM(require_binding());
|
|
@@ -1809,7 +1873,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData) {
|
|
|
1809
1873
|
const { plugin: outro, meta: outroMeta } = bindingifyOutro(plugin, options, pluginContextData);
|
|
1810
1874
|
const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(plugin, options, pluginContextData);
|
|
1811
1875
|
const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(plugin, options, pluginContextData);
|
|
1812
|
-
|
|
1876
|
+
const result = {
|
|
1813
1877
|
name: plugin.name ?? "unknown",
|
|
1814
1878
|
buildStart,
|
|
1815
1879
|
buildStartMeta,
|
|
@@ -1855,6 +1919,25 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData) {
|
|
|
1855
1919
|
closeWatcher,
|
|
1856
1920
|
closeWatcherMeta
|
|
1857
1921
|
};
|
|
1922
|
+
return wrapHandlers(result);
|
|
1923
|
+
}
|
|
1924
|
+
function wrapHandlers(plugin) {
|
|
1925
|
+
for (const hookName of ["buildStart", "resolveId", "resolveDynamicImport", "buildEnd", "transform", "moduleParsed", "load", "renderChunk", "augmentChunkHash", "renderStart", "renderError", "generateBundle", "writeBundle", "closeBundle", "banner", "footer", "intro", "outro", "watchChange", "closeWatcher",]) {
|
|
1926
|
+
const handler = plugin[hookName];
|
|
1927
|
+
if (handler) {
|
|
1928
|
+
plugin[hookName] = async (...args) => {
|
|
1929
|
+
try {
|
|
1930
|
+
return await handler(...args);
|
|
1931
|
+
} catch (e) {
|
|
1932
|
+
return error(logPluginError(e, plugin.name, {
|
|
1933
|
+
hook: hookName,
|
|
1934
|
+
id: hookName === "transform" ? args[2] : undefined
|
|
1935
|
+
}));
|
|
1936
|
+
}
|
|
1937
|
+
};
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
return plugin;
|
|
1858
1941
|
}
|
|
1859
1942
|
|
|
1860
1943
|
//#endregion
|
|
@@ -1862,6 +1945,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData) {
|
|
|
1862
1945
|
class PluginContextData {
|
|
1863
1946
|
moduleOptionMap = new Map();
|
|
1864
1947
|
resolveOptionsMap = new Map();
|
|
1948
|
+
loadModulePromiseMap = new Map();
|
|
1865
1949
|
updateModuleOption(id, option) {
|
|
1866
1950
|
const existing = this.moduleOptionMap.get(id);
|
|
1867
1951
|
if (existing) {
|
|
@@ -2824,22 +2908,24 @@ class Watcher {
|
|
|
2824
2908
|
break;
|
|
2825
2909
|
case "event":
|
|
2826
2910
|
this.inner.on(import_binding.BindingWatcherEvent.Event, async (data) => {
|
|
2827
|
-
|
|
2911
|
+
const code = data.bundleEventKind();
|
|
2912
|
+
switch (code) {
|
|
2828
2913
|
case "BUNDLE_END":
|
|
2914
|
+
const { duration: duration, output: output } = data.bundleEndData();
|
|
2829
2915
|
await listener({
|
|
2830
2916
|
code: "BUNDLE_END",
|
|
2831
|
-
duration
|
|
2832
|
-
output: [
|
|
2917
|
+
duration,
|
|
2918
|
+
output: [output]
|
|
2833
2919
|
});
|
|
2834
2920
|
break;
|
|
2835
2921
|
case "ERROR":
|
|
2836
2922
|
await listener({
|
|
2837
2923
|
code: "ERROR",
|
|
2838
|
-
error: {message: data.error}
|
|
2924
|
+
error: {message: data.error()}
|
|
2839
2925
|
});
|
|
2840
2926
|
break;
|
|
2841
2927
|
default:
|
|
2842
|
-
await listener(
|
|
2928
|
+
await listener({code});
|
|
2843
2929
|
break;
|
|
2844
2930
|
}
|
|
2845
2931
|
});
|
|
@@ -2851,7 +2937,8 @@ class Watcher {
|
|
|
2851
2937
|
break;
|
|
2852
2938
|
case "change":
|
|
2853
2939
|
this.inner.on(import_binding.BindingWatcherEvent.Change, async (data) => {
|
|
2854
|
-
|
|
2940
|
+
const { path: path$2, kind: kind } = data.watchChangeData();
|
|
2941
|
+
await listener(path$2, {event: kind});
|
|
2855
2942
|
});
|
|
2856
2943
|
break;
|
|
2857
2944
|
default: throw new Error(`Unknown event: ${event}`);
|
|
@@ -2863,6 +2950,7 @@ class Watcher {
|
|
|
2863
2950
|
this.controller.signal.addEventListener("abort", () => {
|
|
2864
2951
|
clearInterval(timer);
|
|
2865
2952
|
});
|
|
2953
|
+
process.nextTick(() => this.inner.start());
|
|
2866
2954
|
}
|
|
2867
2955
|
}
|
|
2868
2956
|
|
|
@@ -2895,4 +2983,4 @@ const description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-comp
|
|
|
2895
2983
|
const VERSION = version;
|
|
2896
2984
|
|
|
2897
2985
|
//#endregion
|
|
2898
|
-
export { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, PluginContextData, RollupLogSchema, RollupLogWithStringSchema, TreeshakingOptionsSchema, VERSION, __export, __toESM, aliasPlugin, arraify, bindingifyPlugin, buildImportAnalysisPlugin, composeJsPlugins, defineConfig, description, dynamicImportVarsPlugin, experimental_scan, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, replacePlugin, require_binding, rolldown, transformPlugin, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch };
|
|
2986
|
+
export { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, PluginContextData, RollupLogSchema, RollupLogWithStringSchema, TreeshakingOptionsSchema, VERSION, __export, __toESM, aliasPlugin, arraify, bindingifyPlugin, buildImportAnalysisPlugin, composeJsPlugins, defineConfig, description, dynamicImportVarsPlugin, experimental_scan, importGlobPlugin, isCallableBuiltinPlugin, isCallableCompatibleBuiltinPlugin, jsonPlugin, loadFallbackPlugin, makeBuiltinPluginCallable, manifestPlugin, modulePreloadPolyfillPlugin, replacePlugin, require_binding, rolldown, transformPlugin, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch };
|
package/dist/types/binding.d.ts
CHANGED
|
@@ -8,6 +8,19 @@ export interface RenderedModule {
|
|
|
8
8
|
renderedLength: number
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
export declare class BindingBundleEndEventData {
|
|
12
|
+
output: string
|
|
13
|
+
duration: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export declare class BindingCallableBuiltinPlugin {
|
|
17
|
+
name: string
|
|
18
|
+
constructor(plugin: BindingBuiltinPlugin)
|
|
19
|
+
resolveId(id: string, importer?: string | undefined | null, options?: BindingHookJsResolveIdOptions | undefined | null): Promise<BindingHookJsResolveIdOutput | null>
|
|
20
|
+
load(id: string): Promise<BindingHookJsLoadOutput | null>
|
|
21
|
+
watchChange(path: string, event: BindingJsWatchChangeEvent): Promise<void>
|
|
22
|
+
}
|
|
23
|
+
|
|
11
24
|
export declare class BindingLog {
|
|
12
25
|
code: string
|
|
13
26
|
message: string
|
|
@@ -54,7 +67,7 @@ export declare class BindingOutputs {
|
|
|
54
67
|
}
|
|
55
68
|
|
|
56
69
|
export declare class BindingPluginContext {
|
|
57
|
-
load(specifier: string, fn: () => void): Promise<void>
|
|
70
|
+
load(specifier: string, sideEffects: BindingHookSideEffects | undefined, fn: () => void): Promise<void>
|
|
58
71
|
resolve(specifier: string, importer?: string | undefined | null, extraOptions?: BindingPluginContextResolveOptions | undefined | null): Promise<BindingPluginContextResolvedId | null>
|
|
59
72
|
emitFile(file: BindingEmittedAsset): string
|
|
60
73
|
getFileName(referenceId: string): string
|
|
@@ -73,7 +86,20 @@ export declare class BindingTransformPluginContext {
|
|
|
73
86
|
|
|
74
87
|
export declare class BindingWatcher {
|
|
75
88
|
close(): Promise<void>
|
|
76
|
-
on(event: BindingWatcherEvent, listener: (data
|
|
89
|
+
on(event: BindingWatcherEvent, listener: (data: BindingWatcherEventData) => void): void
|
|
90
|
+
start(): Promise<void>
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export declare class BindingWatcherChangeData {
|
|
94
|
+
path: string
|
|
95
|
+
kind: string
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export declare class BindingWatcherEventData {
|
|
99
|
+
watchChangeData(): BindingWatcherChangeData
|
|
100
|
+
bundleEndData(): BindingBundleEndEventData
|
|
101
|
+
bundleEventKind(): string
|
|
102
|
+
error(): string
|
|
77
103
|
}
|
|
78
104
|
|
|
79
105
|
export declare class Bundler {
|
|
@@ -179,6 +205,22 @@ export interface BindingGlobImportPluginConfig {
|
|
|
179
205
|
restoreQueryExtension?: boolean
|
|
180
206
|
}
|
|
181
207
|
|
|
208
|
+
export interface BindingHookJsLoadOutput {
|
|
209
|
+
code: string
|
|
210
|
+
map?: string
|
|
211
|
+
sideEffects: boolean | 'no-treeshake'
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export interface BindingHookJsResolveIdOptions {
|
|
215
|
+
scan?: boolean
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export interface BindingHookJsResolveIdOutput {
|
|
219
|
+
id: string
|
|
220
|
+
external?: boolean
|
|
221
|
+
sideEffects: boolean | 'no-treeshake'
|
|
222
|
+
}
|
|
223
|
+
|
|
182
224
|
export interface BindingHookLoadOutput {
|
|
183
225
|
code: string
|
|
184
226
|
sideEffects?: BindingHookSideEffects
|
|
@@ -269,6 +311,10 @@ export interface BindingJsonSourcemap {
|
|
|
269
311
|
names?: Array<string>
|
|
270
312
|
}
|
|
271
313
|
|
|
314
|
+
export interface BindingJsWatchChangeEvent {
|
|
315
|
+
event: string
|
|
316
|
+
}
|
|
317
|
+
|
|
272
318
|
export declare enum BindingLogLevel {
|
|
273
319
|
Silent = 0,
|
|
274
320
|
Warn = 1,
|
|
@@ -457,16 +503,21 @@ export interface BindingTreeshake {
|
|
|
457
503
|
export interface BindingViteResolvePluginConfig {
|
|
458
504
|
resolveOptions: BindingViteResolvePluginResolveOptions
|
|
459
505
|
environmentConsumer: string
|
|
506
|
+
environmentName: string
|
|
460
507
|
external: true | string[]
|
|
461
508
|
noExternal: true | string[]
|
|
509
|
+
finalizeBareSpecifier?: (resolvedId: string, rawId: string, importer: string | null | undefined) => VoidNullable<string>
|
|
510
|
+
finalizeOtherSpecifiers?: (resolvedId: string, rawId: string) => VoidNullable<string>
|
|
462
511
|
runtime: string
|
|
463
512
|
}
|
|
464
513
|
|
|
465
514
|
export interface BindingViteResolvePluginResolveOptions {
|
|
515
|
+
isBuild: boolean
|
|
466
516
|
isProduction: boolean
|
|
467
517
|
asSrc: boolean
|
|
468
518
|
preferRelative: boolean
|
|
469
519
|
root: string
|
|
520
|
+
scan: boolean
|
|
470
521
|
mainFields: Array<string>
|
|
471
522
|
conditions: Array<string>
|
|
472
523
|
externalConditions: Array<string>
|
|
@@ -500,6 +551,8 @@ export interface ExtensionAliasItem {
|
|
|
500
551
|
replacements: Array<string>
|
|
501
552
|
}
|
|
502
553
|
|
|
554
|
+
export declare function isCallableCompatibleBuiltinPlugin(plugin: BindingBuiltinPlugin): boolean
|
|
555
|
+
|
|
503
556
|
/** TypeScript Isolated Declarations for Standalone DTS Emit */
|
|
504
557
|
export declare function isolatedDeclaration(filename: string, sourceText: string, options?: IsolatedDeclarationsOptions | undefined | null): IsolatedDeclarationsResult
|
|
505
558
|
|
|
@@ -3,4 +3,4 @@ export { experimental_scan as scan } from './rolldown';
|
|
|
3
3
|
export { transform } from './binding';
|
|
4
4
|
export type { TransformOptions, TransformResult } from './binding';
|
|
5
5
|
export { composeJsPlugins as composePlugins } from './utils/compose-js-plugins';
|
|
6
|
-
export { modulePreloadPolyfillPlugin, dynamicImportVarsPlugin, wasmHelperPlugin, wasmFallbackPlugin, importGlobPlugin, manifestPlugin, loadFallbackPlugin, transformPlugin, aliasPlugin, jsonPlugin, buildImportAnalysisPlugin, replacePlugin, viteResolvePlugin, } from './plugin/builtin-plugin';
|
|
6
|
+
export { modulePreloadPolyfillPlugin, dynamicImportVarsPlugin, wasmHelperPlugin, wasmFallbackPlugin, importGlobPlugin, manifestPlugin, loadFallbackPlugin, transformPlugin, aliasPlugin, jsonPlugin, buildImportAnalysisPlugin, replacePlugin, viteResolvePlugin, isCallableCompatibleBuiltinPlugin, makeBuiltinPluginCallable, isCallableBuiltinPlugin, } from './plugin/builtin-plugin';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TransformPluginConfig } from '../options/normalized-ecma-transform-plugin-config';
|
|
2
2
|
import { AliasPluginConfig } from '../options/normalized-alias-plugin-config';
|
|
3
|
-
import { BindingBuiltinPluginName, BindingGlobImportPluginConfig, BindingBuiltinPlugin, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingJsonPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingReplacePluginConfig, type BindingViteResolvePluginConfig } from '../binding';
|
|
3
|
+
import { BindingBuiltinPluginName, BindingGlobImportPluginConfig, BindingBuiltinPlugin, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingJsonPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingReplacePluginConfig, type BindingViteResolvePluginConfig, BindingCallableBuiltinPlugin } from '../binding';
|
|
4
4
|
export declare class BuiltinPlugin {
|
|
5
5
|
name: BindingBuiltinPluginName;
|
|
6
6
|
options?: unknown;
|
|
@@ -82,4 +82,13 @@ export declare function viteResolvePlugin(config: Omit<BindingViteResolvePluginC
|
|
|
82
82
|
*
|
|
83
83
|
*/
|
|
84
84
|
export declare function replacePlugin(values?: BindingReplacePluginConfig['values'], options?: Omit<BindingReplacePluginConfig, 'values'>): ReplacePlugin;
|
|
85
|
+
export declare function isCallableCompatibleBuiltinPlugin(plugin: any): plugin is BuiltinPlugin;
|
|
86
|
+
type BindingCallableBuiltinPluginLike = {
|
|
87
|
+
[K in keyof BindingCallableBuiltinPlugin]: BindingCallableBuiltinPlugin[K];
|
|
88
|
+
};
|
|
89
|
+
export declare function makeBuiltinPluginCallable(plugin: BuiltinPlugin): BindingCallableBuiltinPluginLike & {
|
|
90
|
+
_original: BindingCallableBuiltinPlugin;
|
|
91
|
+
};
|
|
92
|
+
export declare function isCallableBuiltinPlugin(plugin: any): boolean;
|
|
85
93
|
export declare function bindingifyBuiltInPlugin(plugin: BuiltinPlugin): BindingBuiltinPlugin;
|
|
94
|
+
export {};
|
|
@@ -4,6 +4,7 @@ import { PluginContextResolveOptions } from './plugin-context';
|
|
|
4
4
|
export declare class PluginContextData {
|
|
5
5
|
moduleOptionMap: Map<string, ModuleOptions>;
|
|
6
6
|
resolveOptionsMap: Map<number, PluginContextResolveOptions>;
|
|
7
|
+
loadModulePromiseMap: Map<string, Promise<void>>;
|
|
7
8
|
updateModuleOption(id: string, option: ModuleOptions): void;
|
|
8
9
|
getModuleOption(id: string): ModuleOptions | undefined;
|
|
9
10
|
getModuleInfo(id: string, context: BindingPluginContext): import("..").ModuleInfo | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown",
|
|
3
|
-
"version": "0.14.0-snapshot-
|
|
3
|
+
"version": "0.14.0-snapshot-ae73254-20241120003454",
|
|
4
4
|
"description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
|
|
5
5
|
"homepage": "https://rolldown.rs/",
|
|
6
6
|
"repository": {
|
|
@@ -104,22 +104,22 @@
|
|
|
104
104
|
"vitest": "^2.0.0",
|
|
105
105
|
"why-is-node-running": "^3.0.0",
|
|
106
106
|
"zod-to-json-schema": "^3.23.2",
|
|
107
|
-
"rolldown": "0.14.0-snapshot-
|
|
107
|
+
"rolldown": "0.14.0-snapshot-ae73254-20241120003454",
|
|
108
108
|
"@rolldown/testing": "0.0.1"
|
|
109
109
|
},
|
|
110
110
|
"optionalDependencies": {
|
|
111
|
-
"@rolldown/binding-darwin-arm64": "0.14.0-snapshot-
|
|
112
|
-
"@rolldown/binding-darwin-x64": "0.14.0-snapshot-
|
|
113
|
-
"@rolldown/binding-
|
|
114
|
-
"@rolldown/binding-
|
|
115
|
-
"@rolldown/binding-linux-
|
|
116
|
-
"@rolldown/binding-linux-
|
|
117
|
-
"@rolldown/binding-linux-
|
|
118
|
-
"@rolldown/binding-linux-x64-
|
|
119
|
-
"@rolldown/binding-wasm32-wasi": "0.14.0-snapshot-
|
|
120
|
-
"@rolldown/binding-win32-arm64-msvc": "0.14.0-snapshot-
|
|
121
|
-
"@rolldown/binding-win32-ia32-msvc": "0.14.0-snapshot-
|
|
122
|
-
"@rolldown/binding-win32-x64-msvc": "0.14.0-snapshot-
|
|
111
|
+
"@rolldown/binding-darwin-arm64": "0.14.0-snapshot-ae73254-20241120003454",
|
|
112
|
+
"@rolldown/binding-darwin-x64": "0.14.0-snapshot-ae73254-20241120003454",
|
|
113
|
+
"@rolldown/binding-freebsd-x64": "0.14.0-snapshot-ae73254-20241120003454",
|
|
114
|
+
"@rolldown/binding-linux-arm-gnueabihf": "0.14.0-snapshot-ae73254-20241120003454",
|
|
115
|
+
"@rolldown/binding-linux-arm64-gnu": "0.14.0-snapshot-ae73254-20241120003454",
|
|
116
|
+
"@rolldown/binding-linux-x64-musl": "0.14.0-snapshot-ae73254-20241120003454",
|
|
117
|
+
"@rolldown/binding-linux-arm64-musl": "0.14.0-snapshot-ae73254-20241120003454",
|
|
118
|
+
"@rolldown/binding-linux-x64-gnu": "0.14.0-snapshot-ae73254-20241120003454",
|
|
119
|
+
"@rolldown/binding-wasm32-wasi": "0.14.0-snapshot-ae73254-20241120003454",
|
|
120
|
+
"@rolldown/binding-win32-arm64-msvc": "0.14.0-snapshot-ae73254-20241120003454",
|
|
121
|
+
"@rolldown/binding-win32-ia32-msvc": "0.14.0-snapshot-ae73254-20241120003454",
|
|
122
|
+
"@rolldown/binding-win32-x64-msvc": "0.14.0-snapshot-ae73254-20241120003454"
|
|
123
123
|
},
|
|
124
124
|
"scripts": {
|
|
125
125
|
"# Scrips for binding #": "_",
|