rolldown 0.12.2-snapshot-374cd3d-20240819002934 → 0.12.2-snapshot-55c20b0-20240820002859
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 +2 -2
- package/dist/cjs/experimental-index.cjs +3 -2
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/parallel-plugin-worker.cjs +1 -1
- package/dist/esm/cli.mjs +2 -2
- package/dist/esm/experimental-index.mjs +3 -3
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/parallel-plugin-worker.mjs +1 -1
- package/dist/shared/{plugin-context-data-eCwMEzqF.mjs → plugin-context-data-3UMYUKnN.mjs} +27 -15
- package/dist/shared/{plugin-context-data-vGeV0sRD.cjs → plugin-context-data-seZFF5g3.cjs} +27 -14
- package/dist/shared/{rolldown-DuEg-IqB.mjs → rolldown-PnoYvJia.mjs} +57 -12
- package/dist/shared/rolldown-binding.wasi.cjs +26 -25
- package/dist/shared/{rolldown-GO-j_JDJ.cjs → rolldown-si7UY_70.cjs} +57 -11
- package/dist/types/binding.d.ts +7 -1
- package/dist/types/constants/plugin-context.d.ts +7 -0
- package/dist/types/experimental-index.d.ts +1 -1
- package/dist/types/plugin/builtin-plugin.d.ts +5 -1
- package/dist/types/plugin/index.d.ts +4 -0
- package/dist/types/plugin/plugin-context-data.d.ts +6 -5
- package/dist/types/plugin/plugin-context.d.ts +9 -4
- package/package.json +14 -14
- package/dist/types/utils/ensure-array.d.ts +0 -1
package/dist/cjs/cli.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const { __export, __toESM } = require("../shared/chunk-whRFQvSK.cjs");
|
|
4
|
-
const { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, arraify } = require("../shared/plugin-context-data-
|
|
5
|
-
const { rolldown } = require("../shared/rolldown-
|
|
4
|
+
const { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, arraify } = require("../shared/plugin-context-data-seZFF5g3.cjs");
|
|
5
|
+
const { rolldown } = require("../shared/rolldown-si7UY_70.cjs");
|
|
6
6
|
const { createConsola } = require("../shared/consola.36c0034f-UaviWCqJ.cjs");
|
|
7
7
|
const { default: nodePath } = __toESM(require("node:path"));
|
|
8
8
|
const { ZodFirstPartyTypeKind, ZodFirstPartyTypeKind: ZodFirstPartyTypeKind$1, ZodFirstPartyTypeKind: ZodFirstPartyTypeKind$2, z, z: z$1, z: z$2, z: z$3 } = __toESM(require("zod"));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const { __toESM } = require("../shared/chunk-whRFQvSK.cjs");
|
|
4
|
-
const { require_binding } = require("../shared/plugin-context-data-
|
|
5
|
-
const { aliasPlugin, composeJsPlugins, dynamicImportVarsPlugin, experimental_scan, importGlobPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, transformPlugin, wasmFallbackPlugin, wasmHelperPlugin } = require("../shared/rolldown-
|
|
4
|
+
const { require_binding } = require("../shared/plugin-context-data-seZFF5g3.cjs");
|
|
5
|
+
const { aliasPlugin, composeJsPlugins, dynamicImportVarsPlugin, experimental_scan, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, transformPlugin, wasmFallbackPlugin, wasmHelperPlugin } = require("../shared/rolldown-si7UY_70.cjs");
|
|
6
6
|
const { pathToFileURL } = __toESM(require("node:url"));
|
|
7
7
|
|
|
8
8
|
//#region src/plugin/parallel-plugin.ts
|
|
@@ -27,6 +27,7 @@ exports.composePlugins = composeJsPlugins;
|
|
|
27
27
|
exports.defineParallelPlugin = defineParallelPlugin;
|
|
28
28
|
exports.dynamicImportVarsPlugin = dynamicImportVarsPlugin;
|
|
29
29
|
exports.importGlobPlugin = importGlobPlugin;
|
|
30
|
+
exports.jsonPlugin = jsonPlugin;
|
|
30
31
|
exports.loadFallbackPlugin = loadFallbackPlugin;
|
|
31
32
|
exports.manifestPlugin = manifestPlugin;
|
|
32
33
|
exports.modulePreloadPolyfillPlugin = modulePreloadPolyfillPlugin;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("../shared/plugin-context-data-
|
|
4
|
-
const { rolldown } = require("../shared/rolldown-
|
|
3
|
+
require("../shared/plugin-context-data-seZFF5g3.cjs");
|
|
4
|
+
const { rolldown } = require("../shared/rolldown-si7UY_70.cjs");
|
|
5
5
|
|
|
6
6
|
//#region src/utils/define-config.ts
|
|
7
7
|
function defineConfig(config) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const { __toESM } = require("../shared/chunk-whRFQvSK.cjs");
|
|
4
|
-
const { PluginContextData, bindingifyPlugin, require_binding } = require("../shared/plugin-context-data-
|
|
4
|
+
const { PluginContextData, bindingifyPlugin, require_binding } = require("../shared/plugin-context-data-seZFF5g3.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,7 +1,7 @@
|
|
|
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, __export, arraify } from "../shared/plugin-context-data-
|
|
4
|
-
import { rolldown } from "../shared/rolldown-
|
|
3
|
+
import { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, __export, arraify } from "../shared/plugin-context-data-3UMYUKnN.mjs";
|
|
4
|
+
import { rolldown } from "../shared/rolldown-PnoYvJia.mjs";
|
|
5
5
|
import { createConsola } from "../shared/consola.36c0034f-K0ji0w-3.mjs";
|
|
6
6
|
import { default as nodePath } from "node:path";
|
|
7
7
|
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,7 +1,7 @@
|
|
|
1
1
|
import __node_module__ from 'node:module';
|
|
2
2
|
const require = __node_module__.createRequire(import.meta.url)
|
|
3
|
-
import { __toESM, require_binding } from "../shared/plugin-context-data-
|
|
4
|
-
import { aliasPlugin, composeJsPlugins, dynamicImportVarsPlugin, experimental_scan, importGlobPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, transformPlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/rolldown-
|
|
3
|
+
import { __toESM, require_binding } from "../shared/plugin-context-data-3UMYUKnN.mjs";
|
|
4
|
+
import { aliasPlugin, composeJsPlugins, dynamicImportVarsPlugin, experimental_scan, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, transformPlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/rolldown-PnoYvJia.mjs";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
6
6
|
|
|
7
7
|
//#region src/plugin/parallel-plugin.ts
|
|
@@ -20,4 +20,4 @@ var import_binding = __toESM(require_binding());
|
|
|
20
20
|
|
|
21
21
|
//#endregion
|
|
22
22
|
var transform = import_binding.transform;
|
|
23
|
-
export { aliasPlugin, composeJsPlugins as composePlugins, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, experimental_scan as scan, transform, transformPlugin, wasmFallbackPlugin, wasmHelperPlugin };
|
|
23
|
+
export { aliasPlugin, composeJsPlugins as composePlugins, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, experimental_scan as scan, transform, transformPlugin, wasmFallbackPlugin, wasmHelperPlugin };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import __node_module__ from 'node:module';
|
|
2
2
|
const require = __node_module__.createRequire(import.meta.url)
|
|
3
|
-
import "../shared/plugin-context-data-
|
|
4
|
-
import { rolldown } from "../shared/rolldown-
|
|
3
|
+
import "../shared/plugin-context-data-3UMYUKnN.mjs";
|
|
4
|
+
import { rolldown } from "../shared/rolldown-PnoYvJia.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/utils/define-config.ts
|
|
7
7
|
function defineConfig(config) {
|
|
@@ -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/plugin-context-data-
|
|
3
|
+
import { PluginContextData, __toESM, bindingifyPlugin, require_binding } from "../shared/plugin-context-data-3UMYUKnN.mjs";
|
|
4
4
|
import { parentPort, workerData } from "node:worker_threads";
|
|
5
5
|
|
|
6
6
|
//#region src/parallel-plugin-worker.ts
|
|
@@ -759,12 +759,17 @@ class PluginContext {
|
|
|
759
759
|
return error(logPluginError(normalizeLog(e), pluginName));
|
|
760
760
|
};
|
|
761
761
|
this.resolve = async (source, importer, options$1) => {
|
|
762
|
-
let
|
|
762
|
+
let receipt = undefined;
|
|
763
|
+
if (options$1 != null) {
|
|
764
|
+
receipt = data.saveResolveOptions(options$1);
|
|
765
|
+
}
|
|
763
766
|
const res = await context.resolve(source, importer, {
|
|
764
|
-
custom,
|
|
767
|
+
custom: receipt,
|
|
765
768
|
skipSelf: options$1?.skipSelf
|
|
766
769
|
});
|
|
767
|
-
|
|
770
|
+
if (receipt != null) {
|
|
771
|
+
data.removeSavedResolveOptions(receipt);
|
|
772
|
+
}
|
|
768
773
|
if (res == null) return null;
|
|
769
774
|
const info = data.getModuleOption(res.id) || {};
|
|
770
775
|
return {
|
|
@@ -845,6 +850,10 @@ function bindingPluginOrder(order) {
|
|
|
845
850
|
}
|
|
846
851
|
}
|
|
847
852
|
|
|
853
|
+
//#endregion
|
|
854
|
+
//#region src/constants/plugin-context.ts
|
|
855
|
+
const SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF = Symbol("plugin-context-resolve-caller");
|
|
856
|
+
|
|
848
857
|
//#endregion
|
|
849
858
|
//#region src/plugin/bindingify-build-hooks.ts
|
|
850
859
|
function bindingifyBuildStart(plugin, options, pluginContextData) {
|
|
@@ -874,10 +883,13 @@ function bindingifyResolveId(plugin, options, pluginContextData) {
|
|
|
874
883
|
}
|
|
875
884
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
876
885
|
return [async (ctx, specifier, importer, extraOptions) => {
|
|
877
|
-
const
|
|
886
|
+
const contextResolveOptions = extraOptions.custom != null ? pluginContextData.getSavedResolveOptions(extraOptions.custom) : undefined;
|
|
887
|
+
const newExtraOptions = {
|
|
878
888
|
...extraOptions,
|
|
879
|
-
custom:
|
|
880
|
-
|
|
889
|
+
custom: contextResolveOptions?.custom,
|
|
890
|
+
[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]: contextResolveOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]
|
|
891
|
+
};
|
|
892
|
+
const ret = await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), specifier, importer ?? undefined, newExtraOptions);
|
|
881
893
|
if (ret == false || ret == null) {
|
|
882
894
|
return;
|
|
883
895
|
}
|
|
@@ -1197,7 +1209,7 @@ class PluginContextData {
|
|
|
1197
1209
|
modules = new Map();
|
|
1198
1210
|
moduleIds = null;
|
|
1199
1211
|
moduleOptionMap = new Map();
|
|
1200
|
-
|
|
1212
|
+
resolveOptionsMap = new Map();
|
|
1201
1213
|
updateModuleOption(id, option) {
|
|
1202
1214
|
const existing = this.moduleOptionMap.get(id);
|
|
1203
1215
|
if (existing) {
|
|
@@ -1235,18 +1247,18 @@ class PluginContextData {
|
|
|
1235
1247
|
}
|
|
1236
1248
|
return [].values();
|
|
1237
1249
|
}
|
|
1238
|
-
|
|
1239
|
-
const index =
|
|
1240
|
-
this.
|
|
1250
|
+
saveResolveOptions(options) {
|
|
1251
|
+
const index = this.resolveOptionsMap.size;
|
|
1252
|
+
this.resolveOptionsMap.set(index, options);
|
|
1241
1253
|
return index;
|
|
1242
1254
|
}
|
|
1243
|
-
|
|
1244
|
-
return this.
|
|
1255
|
+
getSavedResolveOptions(receipt) {
|
|
1256
|
+
return this.resolveOptionsMap.get(receipt);
|
|
1245
1257
|
}
|
|
1246
|
-
|
|
1247
|
-
this.
|
|
1258
|
+
removeSavedResolveOptions(receipt) {
|
|
1259
|
+
this.resolveOptionsMap.delete(receipt);
|
|
1248
1260
|
}
|
|
1249
1261
|
}
|
|
1250
1262
|
|
|
1251
1263
|
//#endregion
|
|
1252
|
-
export { LOG_LEVEL_DEBUG, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_WARN, LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, PluginContextData, RollupLogSchema, RollupLogWithStringSchema, __export, __toESM, arraify, bindingifyPlugin, error, getLogHandler, isNullish, logLevelPriority, logPluginError, normalizeHook, normalizeLog, require_binding, transformToRollupOutput, unimplemented };
|
|
1264
|
+
export { LOG_LEVEL_DEBUG, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_WARN, LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, PluginContextData, RollupLogSchema, RollupLogWithStringSchema, SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF, __export, __toESM, arraify, bindingifyPlugin, error, getLogHandler, isNullish, logLevelPriority, logPluginError, normalizeHook, normalizeLog, require_binding, transformToRollupOutput, unimplemented };
|
|
@@ -728,12 +728,17 @@ class PluginContext {
|
|
|
728
728
|
return error(logPluginError(normalizeLog(e), pluginName));
|
|
729
729
|
};
|
|
730
730
|
this.resolve = async (source, importer, options$1) => {
|
|
731
|
-
let
|
|
731
|
+
let receipt = undefined;
|
|
732
|
+
if (options$1 != null) {
|
|
733
|
+
receipt = data.saveResolveOptions(options$1);
|
|
734
|
+
}
|
|
732
735
|
const res = await context.resolve(source, importer, {
|
|
733
|
-
custom,
|
|
736
|
+
custom: receipt,
|
|
734
737
|
skipSelf: options$1?.skipSelf
|
|
735
738
|
});
|
|
736
|
-
|
|
739
|
+
if (receipt != null) {
|
|
740
|
+
data.removeSavedResolveOptions(receipt);
|
|
741
|
+
}
|
|
737
742
|
if (res == null) return null;
|
|
738
743
|
const info = data.getModuleOption(res.id) || {};
|
|
739
744
|
return {
|
|
@@ -814,6 +819,10 @@ function bindingPluginOrder(order) {
|
|
|
814
819
|
}
|
|
815
820
|
}
|
|
816
821
|
|
|
822
|
+
//#endregion
|
|
823
|
+
//#region src/constants/plugin-context.ts
|
|
824
|
+
const SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF = Symbol("plugin-context-resolve-caller");
|
|
825
|
+
|
|
817
826
|
//#endregion
|
|
818
827
|
//#region src/plugin/bindingify-build-hooks.ts
|
|
819
828
|
function bindingifyBuildStart(plugin, options, pluginContextData) {
|
|
@@ -843,10 +852,13 @@ function bindingifyResolveId(plugin, options, pluginContextData) {
|
|
|
843
852
|
}
|
|
844
853
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
845
854
|
return [async (ctx, specifier, importer, extraOptions) => {
|
|
846
|
-
const
|
|
855
|
+
const contextResolveOptions = extraOptions.custom != null ? pluginContextData.getSavedResolveOptions(extraOptions.custom) : undefined;
|
|
856
|
+
const newExtraOptions = {
|
|
847
857
|
...extraOptions,
|
|
848
|
-
custom:
|
|
849
|
-
|
|
858
|
+
custom: contextResolveOptions?.custom,
|
|
859
|
+
[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]: contextResolveOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]
|
|
860
|
+
};
|
|
861
|
+
const ret = await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), specifier, importer ?? undefined, newExtraOptions);
|
|
850
862
|
if (ret == false || ret == null) {
|
|
851
863
|
return;
|
|
852
864
|
}
|
|
@@ -1166,7 +1178,7 @@ class PluginContextData {
|
|
|
1166
1178
|
modules = new Map();
|
|
1167
1179
|
moduleIds = null;
|
|
1168
1180
|
moduleOptionMap = new Map();
|
|
1169
|
-
|
|
1181
|
+
resolveOptionsMap = new Map();
|
|
1170
1182
|
updateModuleOption(id, option) {
|
|
1171
1183
|
const existing = this.moduleOptionMap.get(id);
|
|
1172
1184
|
if (existing) {
|
|
@@ -1204,16 +1216,16 @@ class PluginContextData {
|
|
|
1204
1216
|
}
|
|
1205
1217
|
return [].values();
|
|
1206
1218
|
}
|
|
1207
|
-
|
|
1208
|
-
const index =
|
|
1209
|
-
this.
|
|
1219
|
+
saveResolveOptions(options) {
|
|
1220
|
+
const index = this.resolveOptionsMap.size;
|
|
1221
|
+
this.resolveOptionsMap.set(index, options);
|
|
1210
1222
|
return index;
|
|
1211
1223
|
}
|
|
1212
|
-
|
|
1213
|
-
return this.
|
|
1224
|
+
getSavedResolveOptions(receipt) {
|
|
1225
|
+
return this.resolveOptionsMap.get(receipt);
|
|
1214
1226
|
}
|
|
1215
|
-
|
|
1216
|
-
this.
|
|
1227
|
+
removeSavedResolveOptions(receipt) {
|
|
1228
|
+
this.resolveOptionsMap.delete(receipt);
|
|
1217
1229
|
}
|
|
1218
1230
|
}
|
|
1219
1231
|
|
|
@@ -1228,6 +1240,7 @@ exports.LogLevelWithErrorSchema = LogLevelWithErrorSchema;
|
|
|
1228
1240
|
exports.PluginContextData = PluginContextData;
|
|
1229
1241
|
exports.RollupLogSchema = RollupLogSchema;
|
|
1230
1242
|
exports.RollupLogWithStringSchema = RollupLogWithStringSchema;
|
|
1243
|
+
exports.SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF = SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF;
|
|
1231
1244
|
exports.arraify = arraify;
|
|
1232
1245
|
exports.bindingifyPlugin = bindingifyPlugin;
|
|
1233
1246
|
exports.error = error;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import __node_module__ from 'node:module';
|
|
2
2
|
const require = __node_module__.createRequire(import.meta.url)
|
|
3
|
-
import { LOG_LEVEL_DEBUG, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_WARN, PluginContextData, __toESM, arraify, bindingifyPlugin, error, getLogHandler, isNullish, logLevelPriority, logPluginError, normalizeHook, normalizeLog, require_binding, transformToRollupOutput, unimplemented } from "./plugin-context-data-
|
|
4
|
-
import { default as
|
|
3
|
+
import { LOG_LEVEL_DEBUG, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_WARN, PluginContextData, SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF, __toESM, arraify, bindingifyPlugin, error, getLogHandler, isNullish, logLevelPriority, logPluginError, normalizeHook, normalizeLog, require_binding, transformToRollupOutput, unimplemented } from "./plugin-context-data-3UMYUKnN.mjs";
|
|
4
|
+
import { default as path } from "node:path";
|
|
5
5
|
import { isRegExp, isRegExp as isRegExp$1, isRegExp as isRegExp$2 } from "node:util/types";
|
|
6
6
|
import { Worker } from "node:worker_threads";
|
|
7
7
|
import { availableParallelism } from "node:os";
|
|
@@ -140,6 +140,11 @@ class TransformPlugin extends BuiltinPlugin {
|
|
|
140
140
|
super(import_binding$3.BindingBuiltinPluginName.TransformPlugin, normalizedConfig);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
+
class JsonPlugin extends BuiltinPlugin {
|
|
144
|
+
constructor(config) {
|
|
145
|
+
super(import_binding$3.BindingBuiltinPluginName.JsonPlugin, config);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
143
148
|
function modulePreloadPolyfillPlugin(config) {
|
|
144
149
|
return new ModulePreloadPolyfillPlugin(config);
|
|
145
150
|
}
|
|
@@ -167,6 +172,9 @@ function loadFallbackPlugin() {
|
|
|
167
172
|
function aliasPlugin(config) {
|
|
168
173
|
return new AliasPlugin(config);
|
|
169
174
|
}
|
|
175
|
+
function jsonPlugin(config) {
|
|
176
|
+
return new JsonPlugin(config);
|
|
177
|
+
}
|
|
170
178
|
function bindingifyBuiltInPlugin(plugin) {
|
|
171
179
|
return {
|
|
172
180
|
__name: plugin.name,
|
|
@@ -269,11 +277,7 @@ function bindingifyLogLevel(logLevel) {
|
|
|
269
277
|
function bindingifyInput(input) {
|
|
270
278
|
if (Array.isArray(input)) {
|
|
271
279
|
return input.map((src) => {
|
|
272
|
-
|
|
273
|
-
return {
|
|
274
|
-
name,
|
|
275
|
-
import: src
|
|
276
|
-
};
|
|
280
|
+
return {import: src};
|
|
277
281
|
});
|
|
278
282
|
} else {
|
|
279
283
|
return (Object.entries(input)).map((value) => {
|
|
@@ -524,7 +528,7 @@ function normalizeTreeshakeOptions(config) {
|
|
|
524
528
|
}
|
|
525
529
|
|
|
526
530
|
//#endregion
|
|
527
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
531
|
+
//#region ../../node_modules/.pnpm/remeda@2.11.0/node_modules/remeda/dist/chunk-K26VP6CL.js
|
|
528
532
|
function u$1(t$1, n, a) {
|
|
529
533
|
let o = (r) => t$1(r, ...n);
|
|
530
534
|
return a === void 0 ? o : Object.assign(o, {
|
|
@@ -534,7 +538,7 @@ function u$1(t$1, n, a) {
|
|
|
534
538
|
}
|
|
535
539
|
|
|
536
540
|
//#endregion
|
|
537
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
541
|
+
//#region ../../node_modules/.pnpm/remeda@2.11.0/node_modules/remeda/dist/chunk-RAAYCPUM.js
|
|
538
542
|
function u(r, n, a) {
|
|
539
543
|
let o = r.length - n.length;
|
|
540
544
|
if (o === 0) return r(...n);
|
|
@@ -543,14 +547,14 @@ function u(r, n, a) {
|
|
|
543
547
|
}
|
|
544
548
|
|
|
545
549
|
//#endregion
|
|
546
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
550
|
+
//#region ../../node_modules/.pnpm/remeda@2.11.0/node_modules/remeda/dist/chunk-NMJS7ULY.js
|
|
547
551
|
function t(...n) {
|
|
548
552
|
return u(Object.keys, n);
|
|
549
553
|
}
|
|
550
554
|
|
|
551
555
|
//#endregion
|
|
552
556
|
//#region src/utils/compose-js-plugins.ts
|
|
553
|
-
const unsupportedHookName = ["augmentChunkHash", "generateBundle", "moduleParsed", "onLog", "options", "outputOptions", "renderError", "renderStart", "resolveDynamicImport", "writeBundle",
|
|
557
|
+
const unsupportedHookName = ["augmentChunkHash", "generateBundle", "moduleParsed", "onLog", "options", "outputOptions", "renderError", "renderStart", "resolveDynamicImport", "writeBundle",];
|
|
554
558
|
const unsupportedHooks = new Set(unsupportedHookName);
|
|
555
559
|
function isUnsupportedHooks(hookName) {
|
|
556
560
|
return unsupportedHooks.has(hookName);
|
|
@@ -592,6 +596,14 @@ function createComposedPlugin(plugins) {
|
|
|
592
596
|
}
|
|
593
597
|
break;
|
|
594
598
|
}
|
|
599
|
+
case "resolveId": {
|
|
600
|
+
const handlers = batchedHooks.resolveId ?? [];
|
|
601
|
+
batchedHooks.resolveId = handlers;
|
|
602
|
+
if (plugin.resolveId) {
|
|
603
|
+
handlers.push(plugin.resolveId);
|
|
604
|
+
}
|
|
605
|
+
break;
|
|
606
|
+
}
|
|
595
607
|
case "buildEnd": {
|
|
596
608
|
const handlers = batchedHooks.buildEnd ?? [];
|
|
597
609
|
batchedHooks.buildEnd = handlers;
|
|
@@ -684,6 +696,39 @@ function createComposedPlugin(plugins) {
|
|
|
684
696
|
}
|
|
685
697
|
break;
|
|
686
698
|
}
|
|
699
|
+
case "resolveId": {
|
|
700
|
+
if (batchedHooks.resolveId) {
|
|
701
|
+
const batchedHandlers = batchedHooks.resolveId;
|
|
702
|
+
const handlerSymbols = batchedHandlers.map((_handler, idx) => Symbol(idx));
|
|
703
|
+
composed.resolveId = async function(source, importer, rawHookResolveIdOptions) {
|
|
704
|
+
const hookResolveIdOptions = rawHookResolveIdOptions;
|
|
705
|
+
const symbolForCallerThatSkipSelf = hookResolveIdOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF];
|
|
706
|
+
for (let handlerIdx = 0; handlerIdx < batchedHandlers.length; handlerIdx++) {
|
|
707
|
+
const handler = batchedHandlers[handlerIdx];
|
|
708
|
+
const handlerSymbol = handlerSymbols[handlerIdx];
|
|
709
|
+
if (symbolForCallerThatSkipSelf === handlerSymbol) {
|
|
710
|
+
continue;
|
|
711
|
+
}
|
|
712
|
+
const { handler: handlerFn } = normalizeHook(handler);
|
|
713
|
+
const result = await handlerFn.call({
|
|
714
|
+
...this,
|
|
715
|
+
resolve: (source$1, importer$1, rawContextResolveOptions) => {
|
|
716
|
+
const contextResolveOptions = rawContextResolveOptions ?? {};
|
|
717
|
+
if (contextResolveOptions.skipSelf) {
|
|
718
|
+
contextResolveOptions[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF] = handlerSymbol;
|
|
719
|
+
contextResolveOptions.skipSelf = false;
|
|
720
|
+
}
|
|
721
|
+
return this.resolve(source$1, importer$1, contextResolveOptions);
|
|
722
|
+
}
|
|
723
|
+
}, source, importer, rawHookResolveIdOptions);
|
|
724
|
+
if (!isNullish(result)) {
|
|
725
|
+
return result;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
break;
|
|
731
|
+
}
|
|
687
732
|
case "buildEnd": {
|
|
688
733
|
if (batchedHooks.buildEnd) {
|
|
689
734
|
const batchedHandlers = batchedHooks.buildEnd;
|
|
@@ -987,4 +1032,4 @@ const experimental_scan = async (input) => {
|
|
|
987
1032
|
};
|
|
988
1033
|
|
|
989
1034
|
//#endregion
|
|
990
|
-
export { aliasPlugin, composeJsPlugins, dynamicImportVarsPlugin, experimental_scan, importGlobPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, rolldown, transformPlugin, wasmFallbackPlugin, wasmHelperPlugin };
|
|
1035
|
+
export { aliasPlugin, composeJsPlugins, dynamicImportVarsPlugin, experimental_scan, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, rolldown, transformPlugin, wasmFallbackPlugin, wasmHelperPlugin };
|
|
@@ -124,31 +124,32 @@ function __napi_rs_initialize_modules(__napiInstance) {
|
|
|
124
124
|
__napiInstance.exports['__napi_register__BindingGlobImportPluginConfig_struct_39']?.()
|
|
125
125
|
__napiInstance.exports['__napi_register__BindingManifestPluginConfig_struct_40']?.()
|
|
126
126
|
__napiInstance.exports['__napi_register__BindingModulePreloadPolyfillPluginConfig_struct_41']?.()
|
|
127
|
-
__napiInstance.exports['
|
|
128
|
-
__napiInstance.exports['
|
|
129
|
-
__napiInstance.exports['
|
|
130
|
-
__napiInstance.exports['
|
|
131
|
-
__napiInstance.exports['
|
|
132
|
-
__napiInstance.exports['
|
|
133
|
-
__napiInstance.exports['
|
|
134
|
-
__napiInstance.exports['
|
|
135
|
-
__napiInstance.exports['
|
|
136
|
-
__napiInstance.exports['
|
|
137
|
-
__napiInstance.exports['
|
|
138
|
-
__napiInstance.exports['
|
|
139
|
-
__napiInstance.exports['
|
|
140
|
-
__napiInstance.exports['
|
|
141
|
-
__napiInstance.exports['
|
|
142
|
-
__napiInstance.exports['
|
|
143
|
-
__napiInstance.exports['
|
|
144
|
-
__napiInstance.exports['
|
|
145
|
-
__napiInstance.exports['
|
|
146
|
-
__napiInstance.exports['
|
|
147
|
-
__napiInstance.exports['
|
|
148
|
-
__napiInstance.exports['
|
|
149
|
-
__napiInstance.exports['
|
|
150
|
-
__napiInstance.exports['
|
|
151
|
-
__napiInstance.exports['
|
|
127
|
+
__napiInstance.exports['__napi_register__BindingJsonPluginConfig_struct_42']?.()
|
|
128
|
+
__napiInstance.exports['__napi_register__BindingTransformPluginConfig_struct_43']?.()
|
|
129
|
+
__napiInstance.exports['__napi_register__BindingAliasPluginConfig_struct_44']?.()
|
|
130
|
+
__napiInstance.exports['__napi_register__BindingAliasPluginAlias_struct_45']?.()
|
|
131
|
+
__napiInstance.exports['__napi_register__BindingPluginOrder_46']?.()
|
|
132
|
+
__napiInstance.exports['__napi_register__BindingPluginHookMeta_struct_47']?.()
|
|
133
|
+
__napiInstance.exports['__napi_register__ParallelJsPluginRegistry_struct_48']?.()
|
|
134
|
+
__napiInstance.exports['__napi_register__ParallelJsPluginRegistry_impl_50']?.()
|
|
135
|
+
__napiInstance.exports['__napi_register__register_plugins_51']?.()
|
|
136
|
+
__napiInstance.exports['__napi_register__BindingLog_struct_52']?.()
|
|
137
|
+
__napiInstance.exports['__napi_register__BindingLogLevel_53']?.()
|
|
138
|
+
__napiInstance.exports['__napi_register__BindingModuleInfo_struct_54']?.()
|
|
139
|
+
__napiInstance.exports['__napi_register__BindingModuleInfo_impl_56']?.()
|
|
140
|
+
__napiInstance.exports['__napi_register__BindingOutputAsset_struct_57']?.()
|
|
141
|
+
__napiInstance.exports['__napi_register__BindingOutputAsset_impl_62']?.()
|
|
142
|
+
__napiInstance.exports['__napi_register__BindingOutputChunk_struct_63']?.()
|
|
143
|
+
__napiInstance.exports['__napi_register__BindingOutputChunk_impl_81']?.()
|
|
144
|
+
__napiInstance.exports['__napi_register__BindingOutputs_struct_82']?.()
|
|
145
|
+
__napiInstance.exports['__napi_register__BindingOutputs_impl_86']?.()
|
|
146
|
+
__napiInstance.exports['__napi_register__FinalBindingOutputs_struct_87']?.()
|
|
147
|
+
__napiInstance.exports['__napi_register__FinalBindingOutputs_impl_90']?.()
|
|
148
|
+
__napiInstance.exports['__napi_register__RenderedChunk_struct_91']?.()
|
|
149
|
+
__napiInstance.exports['__napi_register__BindingRenderedModule_struct_92']?.()
|
|
150
|
+
__napiInstance.exports['__napi_register__AliasItem_struct_93']?.()
|
|
151
|
+
__napiInstance.exports['__napi_register__BindingSourcemap_struct_94']?.()
|
|
152
|
+
__napiInstance.exports['__napi_register__BindingJsonSourcemap_struct_95']?.()
|
|
152
153
|
}
|
|
153
154
|
module.exports.BindingLog = __napiModule.exports.BindingLog
|
|
154
155
|
module.exports.BindingModuleInfo = __napiModule.exports.BindingModuleInfo
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const { __toESM } = require("./chunk-whRFQvSK.cjs");
|
|
4
|
-
const { LOG_LEVEL_DEBUG, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_WARN, PluginContextData, arraify, bindingifyPlugin, error, getLogHandler, isNullish, logLevelPriority, logPluginError, normalizeHook, normalizeLog, require_binding, transformToRollupOutput, unimplemented } = require("./plugin-context-data-
|
|
5
|
-
const { default:
|
|
4
|
+
const { LOG_LEVEL_DEBUG, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_WARN, PluginContextData, SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF, arraify, bindingifyPlugin, error, getLogHandler, isNullish, logLevelPriority, logPluginError, normalizeHook, normalizeLog, require_binding, transformToRollupOutput, unimplemented } = require("./plugin-context-data-seZFF5g3.cjs");
|
|
5
|
+
const { default: path } = __toESM(require("node:path"));
|
|
6
6
|
const { isRegExp, isRegExp: isRegExp$1, isRegExp: isRegExp$2 } = __toESM(require("node:util/types"));
|
|
7
7
|
const { Worker } = __toESM(require("node:worker_threads"));
|
|
8
8
|
const { availableParallelism } = __toESM(require("node:os"));
|
|
@@ -141,6 +141,11 @@ class TransformPlugin extends BuiltinPlugin {
|
|
|
141
141
|
super(import_binding$3.BindingBuiltinPluginName.TransformPlugin, normalizedConfig);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
+
class JsonPlugin extends BuiltinPlugin {
|
|
145
|
+
constructor(config) {
|
|
146
|
+
super(import_binding$3.BindingBuiltinPluginName.JsonPlugin, config);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
144
149
|
function modulePreloadPolyfillPlugin(config) {
|
|
145
150
|
return new ModulePreloadPolyfillPlugin(config);
|
|
146
151
|
}
|
|
@@ -168,6 +173,9 @@ function loadFallbackPlugin() {
|
|
|
168
173
|
function aliasPlugin(config) {
|
|
169
174
|
return new AliasPlugin(config);
|
|
170
175
|
}
|
|
176
|
+
function jsonPlugin(config) {
|
|
177
|
+
return new JsonPlugin(config);
|
|
178
|
+
}
|
|
171
179
|
function bindingifyBuiltInPlugin(plugin) {
|
|
172
180
|
return {
|
|
173
181
|
__name: plugin.name,
|
|
@@ -270,11 +278,7 @@ function bindingifyLogLevel(logLevel) {
|
|
|
270
278
|
function bindingifyInput(input) {
|
|
271
279
|
if (Array.isArray(input)) {
|
|
272
280
|
return input.map((src) => {
|
|
273
|
-
|
|
274
|
-
return {
|
|
275
|
-
name,
|
|
276
|
-
import: src
|
|
277
|
-
};
|
|
281
|
+
return {import: src};
|
|
278
282
|
});
|
|
279
283
|
} else {
|
|
280
284
|
return (Object.entries(input)).map((value) => {
|
|
@@ -525,7 +529,7 @@ function normalizeTreeshakeOptions(config) {
|
|
|
525
529
|
}
|
|
526
530
|
|
|
527
531
|
//#endregion
|
|
528
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
532
|
+
//#region ../../node_modules/.pnpm/remeda@2.11.0/node_modules/remeda/dist/chunk-K26VP6CL.js
|
|
529
533
|
function u$1(t$1, n, a) {
|
|
530
534
|
let o = (r) => t$1(r, ...n);
|
|
531
535
|
return a === void 0 ? o : Object.assign(o, {
|
|
@@ -535,7 +539,7 @@ function u$1(t$1, n, a) {
|
|
|
535
539
|
}
|
|
536
540
|
|
|
537
541
|
//#endregion
|
|
538
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
542
|
+
//#region ../../node_modules/.pnpm/remeda@2.11.0/node_modules/remeda/dist/chunk-RAAYCPUM.js
|
|
539
543
|
function u(r, n, a) {
|
|
540
544
|
let o = r.length - n.length;
|
|
541
545
|
if (o === 0) return r(...n);
|
|
@@ -544,14 +548,14 @@ function u(r, n, a) {
|
|
|
544
548
|
}
|
|
545
549
|
|
|
546
550
|
//#endregion
|
|
547
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
551
|
+
//#region ../../node_modules/.pnpm/remeda@2.11.0/node_modules/remeda/dist/chunk-NMJS7ULY.js
|
|
548
552
|
function t(...n) {
|
|
549
553
|
return u(Object.keys, n);
|
|
550
554
|
}
|
|
551
555
|
|
|
552
556
|
//#endregion
|
|
553
557
|
//#region src/utils/compose-js-plugins.ts
|
|
554
|
-
const unsupportedHookName = ["augmentChunkHash", "generateBundle", "moduleParsed", "onLog", "options", "outputOptions", "renderError", "renderStart", "resolveDynamicImport", "writeBundle",
|
|
558
|
+
const unsupportedHookName = ["augmentChunkHash", "generateBundle", "moduleParsed", "onLog", "options", "outputOptions", "renderError", "renderStart", "resolveDynamicImport", "writeBundle",];
|
|
555
559
|
const unsupportedHooks = new Set(unsupportedHookName);
|
|
556
560
|
function isUnsupportedHooks(hookName) {
|
|
557
561
|
return unsupportedHooks.has(hookName);
|
|
@@ -593,6 +597,14 @@ function createComposedPlugin(plugins) {
|
|
|
593
597
|
}
|
|
594
598
|
break;
|
|
595
599
|
}
|
|
600
|
+
case "resolveId": {
|
|
601
|
+
const handlers = batchedHooks.resolveId ?? [];
|
|
602
|
+
batchedHooks.resolveId = handlers;
|
|
603
|
+
if (plugin.resolveId) {
|
|
604
|
+
handlers.push(plugin.resolveId);
|
|
605
|
+
}
|
|
606
|
+
break;
|
|
607
|
+
}
|
|
596
608
|
case "buildEnd": {
|
|
597
609
|
const handlers = batchedHooks.buildEnd ?? [];
|
|
598
610
|
batchedHooks.buildEnd = handlers;
|
|
@@ -685,6 +697,39 @@ function createComposedPlugin(plugins) {
|
|
|
685
697
|
}
|
|
686
698
|
break;
|
|
687
699
|
}
|
|
700
|
+
case "resolveId": {
|
|
701
|
+
if (batchedHooks.resolveId) {
|
|
702
|
+
const batchedHandlers = batchedHooks.resolveId;
|
|
703
|
+
const handlerSymbols = batchedHandlers.map((_handler, idx) => Symbol(idx));
|
|
704
|
+
composed.resolveId = async function(source, importer, rawHookResolveIdOptions) {
|
|
705
|
+
const hookResolveIdOptions = rawHookResolveIdOptions;
|
|
706
|
+
const symbolForCallerThatSkipSelf = hookResolveIdOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF];
|
|
707
|
+
for (let handlerIdx = 0; handlerIdx < batchedHandlers.length; handlerIdx++) {
|
|
708
|
+
const handler = batchedHandlers[handlerIdx];
|
|
709
|
+
const handlerSymbol = handlerSymbols[handlerIdx];
|
|
710
|
+
if (symbolForCallerThatSkipSelf === handlerSymbol) {
|
|
711
|
+
continue;
|
|
712
|
+
}
|
|
713
|
+
const { handler: handlerFn } = normalizeHook(handler);
|
|
714
|
+
const result = await handlerFn.call({
|
|
715
|
+
...this,
|
|
716
|
+
resolve: (source$1, importer$1, rawContextResolveOptions) => {
|
|
717
|
+
const contextResolveOptions = rawContextResolveOptions ?? {};
|
|
718
|
+
if (contextResolveOptions.skipSelf) {
|
|
719
|
+
contextResolveOptions[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF] = handlerSymbol;
|
|
720
|
+
contextResolveOptions.skipSelf = false;
|
|
721
|
+
}
|
|
722
|
+
return this.resolve(source$1, importer$1, contextResolveOptions);
|
|
723
|
+
}
|
|
724
|
+
}, source, importer, rawHookResolveIdOptions);
|
|
725
|
+
if (!isNullish(result)) {
|
|
726
|
+
return result;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
break;
|
|
732
|
+
}
|
|
688
733
|
case "buildEnd": {
|
|
689
734
|
if (batchedHooks.buildEnd) {
|
|
690
735
|
const batchedHandlers = batchedHooks.buildEnd;
|
|
@@ -993,6 +1038,7 @@ exports.composeJsPlugins = composeJsPlugins;
|
|
|
993
1038
|
exports.dynamicImportVarsPlugin = dynamicImportVarsPlugin;
|
|
994
1039
|
exports.experimental_scan = experimental_scan;
|
|
995
1040
|
exports.importGlobPlugin = importGlobPlugin;
|
|
1041
|
+
exports.jsonPlugin = jsonPlugin;
|
|
996
1042
|
exports.loadFallbackPlugin = loadFallbackPlugin;
|
|
997
1043
|
exports.manifestPlugin = manifestPlugin;
|
|
998
1044
|
exports.modulePreloadPolyfillPlugin = modulePreloadPolyfillPlugin;
|
package/dist/types/binding.d.ts
CHANGED
|
@@ -128,7 +128,8 @@ export declare enum BindingBuiltinPluginName {
|
|
|
128
128
|
LoadFallbackPlugin = 5,
|
|
129
129
|
TransformPlugin = 6,
|
|
130
130
|
WasmFallbackPlugin = 7,
|
|
131
|
-
AliasPlugin = 8
|
|
131
|
+
AliasPlugin = 8,
|
|
132
|
+
JsonPlugin = 9
|
|
132
133
|
}
|
|
133
134
|
|
|
134
135
|
export interface BindingEmittedAsset {
|
|
@@ -213,6 +214,11 @@ export interface BindingInputOptions {
|
|
|
213
214
|
inject?: Array<BindingInjectImportNamed | BindingInjectImportNamespace>
|
|
214
215
|
}
|
|
215
216
|
|
|
217
|
+
export interface BindingJsonPluginConfig {
|
|
218
|
+
stringify?: boolean
|
|
219
|
+
isBuild?: boolean
|
|
220
|
+
}
|
|
221
|
+
|
|
216
222
|
export interface BindingJsonSourcemap {
|
|
217
223
|
file?: string
|
|
218
224
|
mappings?: string
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* If Composed plugins call `this.resolve` with `skipSelf: true`, the composed plugins will be skipped as a whole.
|
|
3
|
+
* To prevent that, we use this symbol to store the actual caller of `this.resolve` with `skipSelf: true`. And we
|
|
4
|
+
* will modify the skipSelf option to `false` and use this symbol to skip the caller itself in the composed plugins
|
|
5
|
+
* internally.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF: unique symbol;
|
|
@@ -2,4 +2,4 @@ export { defineParallelPlugin } from './plugin/parallel-plugin';
|
|
|
2
2
|
export { experimental_scan as scan } from './rolldown';
|
|
3
3
|
export { transform } from './binding';
|
|
4
4
|
export { composeJsPlugins as composePlugins } from './utils/compose-js-plugins';
|
|
5
|
-
export { modulePreloadPolyfillPlugin, dynamicImportVarsPlugin, wasmHelperPlugin, wasmFallbackPlugin, importGlobPlugin, manifestPlugin, loadFallbackPlugin, transformPlugin, aliasPlugin, } from './plugin/builtin-plugin';
|
|
5
|
+
export { modulePreloadPolyfillPlugin, dynamicImportVarsPlugin, wasmHelperPlugin, wasmFallbackPlugin, importGlobPlugin, manifestPlugin, loadFallbackPlugin, transformPlugin, aliasPlugin, jsonPlugin, } 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 } from '../binding';
|
|
3
|
+
import { BindingBuiltinPluginName, BindingGlobImportPluginConfig, BindingBuiltinPlugin, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingJsonPluginConfig } from '../binding';
|
|
4
4
|
export declare class BuiltinPlugin {
|
|
5
5
|
name: BindingBuiltinPluginName;
|
|
6
6
|
options?: unknown;
|
|
@@ -33,6 +33,9 @@ export declare class AliasPlugin extends BuiltinPlugin {
|
|
|
33
33
|
export declare class TransformPlugin extends BuiltinPlugin {
|
|
34
34
|
constructor(config?: TransformPluginConfig);
|
|
35
35
|
}
|
|
36
|
+
export declare class JsonPlugin extends BuiltinPlugin {
|
|
37
|
+
constructor(config?: BindingJsonPluginConfig);
|
|
38
|
+
}
|
|
36
39
|
export declare function modulePreloadPolyfillPlugin(config?: BindingModulePreloadPolyfillPluginConfig): ModulePreloadPolyfillPlugin;
|
|
37
40
|
export declare function dynamicImportVarsPlugin(): DynamicImportVarsPlugin;
|
|
38
41
|
export declare function importGlobPlugin(config?: BindingGlobImportPluginConfig): ImportGlobPlugin;
|
|
@@ -42,4 +45,5 @@ export declare function wasmFallbackPlugin(): WasmFallbackPlugin;
|
|
|
42
45
|
export declare function transformPlugin(config?: TransformPluginConfig): TransformPlugin;
|
|
43
46
|
export declare function loadFallbackPlugin(): LoadFallbackPlugin;
|
|
44
47
|
export declare function aliasPlugin(config: AliasPluginConfig): AliasPlugin;
|
|
48
|
+
export declare function jsonPlugin(config?: BindingJsonPluginConfig): JsonPlugin;
|
|
45
49
|
export declare function bindingifyBuiltInPlugin(plugin: BuiltinPlugin): BindingBuiltinPlugin;
|
|
@@ -15,6 +15,7 @@ import { BuiltinPlugin } from './builtin-plugin';
|
|
|
15
15
|
import { ParallelPlugin } from './parallel-plugin';
|
|
16
16
|
import type { DefinedHookNames } from '../constants/plugin';
|
|
17
17
|
import { DEFINED_HOOK_NAMES } from '../constants/plugin';
|
|
18
|
+
import { SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF } from '../constants/plugin-context';
|
|
18
19
|
export type ModuleSideEffects = boolean | 'no-treeshake' | null;
|
|
19
20
|
export type ModuleType = 'js' | 'jsx' | 'ts' | 'tsx' | 'json' | 'text' | 'base64' | 'dataurl' | 'binary' | 'empty' | (string & {});
|
|
20
21
|
export type ImportKind = BindingHookResolveIdExtraArgs['kind'];
|
|
@@ -43,6 +44,9 @@ interface ResolveIdExtraOptions {
|
|
|
43
44
|
isEntry: boolean;
|
|
44
45
|
kind: 'import' | 'dynamic-import' | 'require-call';
|
|
45
46
|
}
|
|
47
|
+
export interface PrivateResolveIdExtraOptions extends ResolveIdExtraOptions {
|
|
48
|
+
[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]?: symbol;
|
|
49
|
+
}
|
|
46
50
|
export type ResolveIdResult = string | NullValue | false | PartialResolvedId;
|
|
47
51
|
export type LoadResult = NullValue | string | SourceDescription;
|
|
48
52
|
export type TransformResult = NullValue | string | Partial<SourceDescription>;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { BindingPluginContext } from '../binding';
|
|
2
|
-
import {
|
|
2
|
+
import { ModuleInfo, ModuleOptions } from '..';
|
|
3
|
+
import { PluginContextResolveOptions } from './plugin-context';
|
|
3
4
|
export declare class PluginContextData {
|
|
4
5
|
modules: Map<string, ModuleInfo>;
|
|
5
6
|
moduleIds: Array<string> | null;
|
|
6
7
|
moduleOptionMap: Map<string, ModuleOptions>;
|
|
7
|
-
|
|
8
|
+
resolveOptionsMap: Map<number, PluginContextResolveOptions>;
|
|
8
9
|
updateModuleOption(id: string, option: ModuleOptions): void;
|
|
9
10
|
getModuleOption(id: string): ModuleOptions | undefined;
|
|
10
11
|
getModuleInfo(id: string, context: BindingPluginContext): ModuleInfo | null;
|
|
11
12
|
getModuleIds(context: BindingPluginContext): IterableIterator<string>;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
saveResolveOptions(options: PluginContextResolveOptions): number;
|
|
14
|
+
getSavedResolveOptions(receipt: number): PluginContextResolveOptions | undefined;
|
|
15
|
+
removeSavedResolveOptions(receipt: number): void;
|
|
15
16
|
}
|
|
@@ -5,6 +5,7 @@ import type { CustomPluginOptions, Plugin, ResolvedId } from './index';
|
|
|
5
5
|
import { AssetSource } from '../utils/asset-source';
|
|
6
6
|
import { ModuleInfo } from '../types/module-info';
|
|
7
7
|
import { PluginContextData } from './plugin-context-data';
|
|
8
|
+
import { SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF } from '../constants/plugin-context';
|
|
8
9
|
export interface EmittedAsset {
|
|
9
10
|
type: 'asset';
|
|
10
11
|
name?: string;
|
|
@@ -12,15 +13,19 @@ export interface EmittedAsset {
|
|
|
12
13
|
source: AssetSource;
|
|
13
14
|
}
|
|
14
15
|
export type EmittedFile = EmittedAsset;
|
|
16
|
+
export interface PluginContextResolveOptions {
|
|
17
|
+
skipSelf?: boolean;
|
|
18
|
+
custom?: CustomPluginOptions;
|
|
19
|
+
}
|
|
20
|
+
export interface PrivatePluginContextResolveOptions extends PluginContextResolveOptions {
|
|
21
|
+
[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]?: symbol;
|
|
22
|
+
}
|
|
15
23
|
export declare class PluginContext {
|
|
16
24
|
debug: LoggingFunction;
|
|
17
25
|
info: LoggingFunction;
|
|
18
26
|
warn: LoggingFunction;
|
|
19
27
|
error: (error: RollupError | string) => never;
|
|
20
|
-
resolve: (source: string, importer?: string, options?:
|
|
21
|
-
custom?: CustomPluginOptions;
|
|
22
|
-
skipSelf?: boolean;
|
|
23
|
-
}) => Promise<ResolvedId | null>;
|
|
28
|
+
resolve: (source: string, importer?: string, options?: PluginContextResolveOptions) => Promise<ResolvedId | null>;
|
|
24
29
|
emitFile: (file: EmittedAsset) => string;
|
|
25
30
|
getFileName: (referenceId: string) => string;
|
|
26
31
|
getModuleInfo: (id: string) => ModuleInfo | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown",
|
|
3
|
-
"version": "0.12.2-snapshot-
|
|
3
|
+
"version": "0.12.2-snapshot-55c20b0-20240820002859",
|
|
4
4
|
"description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
|
|
5
5
|
"homepage": "https://rolldown.rs/",
|
|
6
6
|
"repository": {
|
|
@@ -102,21 +102,21 @@
|
|
|
102
102
|
"why-is-node-running": "^3.0.0",
|
|
103
103
|
"zod-to-json-schema": "^3.23.2",
|
|
104
104
|
"@rolldown/testing": "0.0.1",
|
|
105
|
-
"rolldown": "0.12.2-snapshot-
|
|
105
|
+
"rolldown": "0.12.2-snapshot-55c20b0-20240820002859"
|
|
106
106
|
},
|
|
107
107
|
"optionalDependencies": {
|
|
108
|
-
"@rolldown/binding-
|
|
109
|
-
"@rolldown/binding-darwin-
|
|
110
|
-
"@rolldown/binding-
|
|
111
|
-
"@rolldown/binding-
|
|
112
|
-
"@rolldown/binding-
|
|
113
|
-
"@rolldown/binding-linux-
|
|
114
|
-
"@rolldown/binding-linux-
|
|
115
|
-
"@rolldown/binding-linux-x64-musl": "0.12.2-snapshot-
|
|
116
|
-
"@rolldown/binding-wasm32-wasi": "0.12.2-snapshot-
|
|
117
|
-
"@rolldown/binding-win32-ia32-msvc": "0.12.2-snapshot-
|
|
118
|
-
"@rolldown/binding-win32-
|
|
119
|
-
"@rolldown/binding-win32-
|
|
108
|
+
"@rolldown/binding-darwin-arm64": "0.12.2-snapshot-55c20b0-20240820002859",
|
|
109
|
+
"@rolldown/binding-darwin-x64": "0.12.2-snapshot-55c20b0-20240820002859",
|
|
110
|
+
"@rolldown/binding-linux-arm-gnueabihf": "0.12.2-snapshot-55c20b0-20240820002859",
|
|
111
|
+
"@rolldown/binding-freebsd-x64": "0.12.2-snapshot-55c20b0-20240820002859",
|
|
112
|
+
"@rolldown/binding-linux-arm64-gnu": "0.12.2-snapshot-55c20b0-20240820002859",
|
|
113
|
+
"@rolldown/binding-linux-x64-gnu": "0.12.2-snapshot-55c20b0-20240820002859",
|
|
114
|
+
"@rolldown/binding-linux-arm64-musl": "0.12.2-snapshot-55c20b0-20240820002859",
|
|
115
|
+
"@rolldown/binding-linux-x64-musl": "0.12.2-snapshot-55c20b0-20240820002859",
|
|
116
|
+
"@rolldown/binding-wasm32-wasi": "0.12.2-snapshot-55c20b0-20240820002859",
|
|
117
|
+
"@rolldown/binding-win32-ia32-msvc": "0.12.2-snapshot-55c20b0-20240820002859",
|
|
118
|
+
"@rolldown/binding-win32-x64-msvc": "0.12.2-snapshot-55c20b0-20240820002859",
|
|
119
|
+
"@rolldown/binding-win32-arm64-msvc": "0.12.2-snapshot-55c20b0-20240820002859"
|
|
120
120
|
},
|
|
121
121
|
"scripts": {
|
|
122
122
|
"# Scrips for binding #": "_",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function ensureArray<T>(items: (T | false | null | undefined)[] | T | false | null | undefined): T[];
|