rolldown 0.12.2-snapshot-3ea6797-20240810002921 → 0.12.2-snapshot-a2bb2ca-20240811003152
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 +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/parallel-plugin-worker.cjs +1 -1
- package/dist/esm/cli.mjs +2 -2
- package/dist/esm/experimental-index.mjs +2 -2
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/parallel-plugin-worker.mjs +1 -1
- package/dist/shared/{plugin-context-data-I1aPS5hK.cjs → plugin-context-data-1VeqieJQ.cjs} +141 -90
- package/dist/shared/{plugin-context-data-l2hAUTQq.mjs → plugin-context-data-N8cNBCJA.mjs} +141 -90
- package/dist/shared/{rolldown-gbhp04Mo.mjs → rolldown-AqcHCfh8.mjs} +1 -1
- package/dist/shared/rolldown-binding.wasi.cjs +23 -20
- package/dist/shared/rolldown-tWN4pzYf.cjs +1 -1
- package/dist/types/binding.d.ts +26 -0
- package/dist/types/options/normalized-ecma-transform-plugin-config.d.ts +1 -1
- package/dist/types/plugin/bindingify-build-hooks.d.ts +8 -7
- package/dist/types/plugin/bindingify-output-hooks.d.ts +11 -10
- package/dist/types/plugin/bindingify-plugin-hook-meta.d.ts +7 -0
- package/dist/types/plugin/index.d.ts +5 -1
- package/package.json +14 -14
package/dist/cjs/cli.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { __commonJSMin, __export, __toESM } = require("../shared/chunk-whRFQvSK.cjs");
|
|
2
|
-
const { arraify } = require("../shared/plugin-context-data-
|
|
2
|
+
const { arraify } = require("../shared/plugin-context-data-1VeqieJQ.cjs");
|
|
3
3
|
const { rolldown } = require("../shared/rolldown-tWN4pzYf.cjs");
|
|
4
4
|
const { colors, consola, createConsola } = require("../shared/consola.36c0034f-UsYo1a5T.cjs");
|
|
5
5
|
const { default: nodePath } = __toESM(require("node:path"));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const { __toESM } = require("../shared/chunk-whRFQvSK.cjs");
|
|
4
|
-
const { require_binding } = require("../shared/plugin-context-data-
|
|
4
|
+
const { require_binding } = require("../shared/plugin-context-data-1VeqieJQ.cjs");
|
|
5
5
|
const { dynamicImportVarsPlugin, experimental_scan, globImportPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, transformPlugin, wasmPlugin } = require("../shared/rolldown-tWN4pzYf.cjs");
|
|
6
6
|
const { pathToFileURL } = __toESM(require("node:url"));
|
|
7
7
|
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -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-1VeqieJQ.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 { __commonJSMin, __export, __toESM, arraify } from "../shared/plugin-context-data-
|
|
4
|
-
import { rolldown } from "../shared/rolldown-
|
|
3
|
+
import { __commonJSMin, __export, __toESM, arraify } from "../shared/plugin-context-data-N8cNBCJA.mjs";
|
|
4
|
+
import { rolldown } from "../shared/rolldown-AqcHCfh8.mjs";
|
|
5
5
|
import { colors, consola, createConsola } from "../shared/consola.36c0034f-VfFiWRgU.mjs";
|
|
6
6
|
import { default as nodePath } from "node:path";
|
|
7
7
|
import { default as process$1, env } from "node:process";
|
|
@@ -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 { dynamicImportVarsPlugin, experimental_scan, globImportPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, transformPlugin, wasmPlugin } from "../shared/rolldown-
|
|
3
|
+
import { __toESM, require_binding } from "../shared/plugin-context-data-N8cNBCJA.mjs";
|
|
4
|
+
import { dynamicImportVarsPlugin, experimental_scan, globImportPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, transformPlugin, wasmPlugin } from "../shared/rolldown-AqcHCfh8.mjs";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
6
6
|
|
|
7
7
|
//#region src/plugin/parallel-plugin.ts
|
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-N8cNBCJA.mjs";
|
|
4
|
+
import { rolldown } from "../shared/rolldown-AqcHCfh8.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-N8cNBCJA.mjs";
|
|
4
4
|
import { parentPort, workerData } from "node:worker_threads";
|
|
5
5
|
|
|
6
6
|
//#region src/parallel-plugin-worker.ts
|
|
@@ -418,6 +418,7 @@ var require_binding = __commonJSMin((exports, module) => {
|
|
|
418
418
|
module.exports.BindingBuiltinPluginName = nativeBinding.BindingBuiltinPluginName;
|
|
419
419
|
module.exports.BindingHookSideEffects = nativeBinding.BindingHookSideEffects;
|
|
420
420
|
module.exports.BindingLogLevel = nativeBinding.BindingLogLevel;
|
|
421
|
+
module.exports.BindingPluginOrder = nativeBinding.BindingPluginOrder;
|
|
421
422
|
module.exports.isolatedDeclaration = nativeBinding.isolatedDeclaration;
|
|
422
423
|
module.exports.registerPlugins = nativeBinding.registerPlugins;
|
|
423
424
|
module.exports.transform = nativeBinding.transform;
|
|
@@ -770,47 +771,63 @@ class TransformPluginContext extends PluginContext {
|
|
|
770
771
|
|
|
771
772
|
//#endregion
|
|
772
773
|
//#region src/utils/transform-side-effects.ts
|
|
773
|
-
var import_binding = __toESM(require_binding());
|
|
774
|
+
var import_binding$1 = __toESM(require_binding());
|
|
774
775
|
function bindingifySideEffects(sideEffects) {
|
|
775
776
|
switch (sideEffects) {
|
|
776
|
-
case true: return import_binding.BindingHookSideEffects.True;
|
|
777
|
-
case false: return import_binding.BindingHookSideEffects.False;
|
|
778
|
-
case "no-treeshake": return import_binding.BindingHookSideEffects.NoTreeshake;
|
|
777
|
+
case true: return import_binding$1.BindingHookSideEffects.True;
|
|
778
|
+
case false: return import_binding$1.BindingHookSideEffects.False;
|
|
779
|
+
case "no-treeshake": return import_binding$1.BindingHookSideEffects.NoTreeshake;
|
|
779
780
|
case null:
|
|
780
781
|
case undefined: return undefined;
|
|
781
782
|
default: throw new Error(`Unexpected side effects: ${sideEffects}`);
|
|
782
783
|
}
|
|
783
784
|
}
|
|
784
785
|
|
|
786
|
+
//#endregion
|
|
787
|
+
//#region src/plugin/bindingify-plugin-hook-meta.ts
|
|
788
|
+
var import_binding = __toESM(require_binding());
|
|
789
|
+
function bindingifyPluginHookMeta(options) {
|
|
790
|
+
return {order: bindingPluginOrder(options.order)};
|
|
791
|
+
}
|
|
792
|
+
function bindingPluginOrder(order) {
|
|
793
|
+
switch (order) {
|
|
794
|
+
case "post": return import_binding.BindingPluginOrder.Post;
|
|
795
|
+
case "pre": return import_binding.BindingPluginOrder.Pre;
|
|
796
|
+
case null:
|
|
797
|
+
case undefined: return undefined;
|
|
798
|
+
default: throw new Error(`Unknown plugin order: ${order}`);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
|
|
785
802
|
//#endregion
|
|
786
803
|
//#region src/plugin/bindingify-build-hooks.ts
|
|
787
804
|
function bindingifyBuildStart(plugin, options, pluginContextData) {
|
|
788
805
|
const hook = plugin.buildStart;
|
|
789
806
|
if (!hook) {
|
|
790
|
-
return undefined;
|
|
807
|
+
return [undefined, undefined];
|
|
791
808
|
}
|
|
792
|
-
const [handler,
|
|
793
|
-
return async (ctx) => {
|
|
809
|
+
const [handler, meta] = normalizeHook(hook);
|
|
810
|
+
return [async (ctx) => {
|
|
794
811
|
await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), options);
|
|
795
|
-
};
|
|
812
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
796
813
|
}
|
|
797
814
|
function bindingifyBuildEnd(plugin, options, pluginContextData) {
|
|
798
815
|
const hook = plugin.buildEnd;
|
|
799
816
|
if (!hook) {
|
|
800
|
-
return undefined;
|
|
817
|
+
return [undefined, undefined];
|
|
801
818
|
}
|
|
802
|
-
const [handler,
|
|
803
|
-
return async (ctx, err) => {
|
|
819
|
+
const [handler, meta] = normalizeHook(hook);
|
|
820
|
+
return [async (ctx, err) => {
|
|
804
821
|
await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), err ? new Error(err) : undefined);
|
|
805
|
-
};
|
|
822
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
806
823
|
}
|
|
807
824
|
function bindingifyResolveId(plugin, options, pluginContextData) {
|
|
808
825
|
const hook = plugin.resolveId;
|
|
809
826
|
if (!hook) {
|
|
810
|
-
return undefined;
|
|
827
|
+
return [undefined, undefined];
|
|
811
828
|
}
|
|
812
|
-
const [handler,
|
|
813
|
-
return async (ctx, specifier, importer, extraOptions) => {
|
|
829
|
+
const [handler, meta] = normalizeHook(hook);
|
|
830
|
+
return [async (ctx, specifier, importer, extraOptions) => {
|
|
814
831
|
const ret = await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), specifier, importer ?? undefined, {
|
|
815
832
|
...extraOptions,
|
|
816
833
|
custom: typeof extraOptions.custom === "number" ? pluginContextData.getResolveCustom(extraOptions.custom) : undefined
|
|
@@ -833,15 +850,15 @@ function bindingifyResolveId(plugin, options, pluginContextData) {
|
|
|
833
850
|
moduleSideEffects: ret.moduleSideEffects || null
|
|
834
851
|
});
|
|
835
852
|
return result;
|
|
836
|
-
};
|
|
853
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
837
854
|
}
|
|
838
855
|
function bindingifyResolveDynamicImport(plugin, options, pluginContextData) {
|
|
839
856
|
const hook = plugin.resolveDynamicImport;
|
|
840
857
|
if (!hook) {
|
|
841
|
-
return undefined;
|
|
858
|
+
return [undefined, undefined];
|
|
842
859
|
}
|
|
843
|
-
const [handler,
|
|
844
|
-
return async (ctx, specifier, importer) => {
|
|
860
|
+
const [handler, meta] = normalizeHook(hook);
|
|
861
|
+
return [async (ctx, specifier, importer) => {
|
|
845
862
|
const ret = await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), specifier, importer ?? undefined);
|
|
846
863
|
if (ret == false || ret == null) {
|
|
847
864
|
return;
|
|
@@ -861,16 +878,16 @@ function bindingifyResolveDynamicImport(plugin, options, pluginContextData) {
|
|
|
861
878
|
moduleSideEffects: ret.moduleSideEffects || null
|
|
862
879
|
});
|
|
863
880
|
return result;
|
|
864
|
-
};
|
|
881
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
865
882
|
}
|
|
866
883
|
function bindingifyTransform(plugin, options, pluginContextData) {
|
|
867
884
|
const hook = plugin.transform;
|
|
868
885
|
if (!hook) {
|
|
869
|
-
return undefined;
|
|
886
|
+
return [undefined, undefined];
|
|
870
887
|
}
|
|
871
|
-
const [handler,
|
|
872
|
-
return async (ctx, code, id, meta) => {
|
|
873
|
-
const ret = await handler.call(new TransformPluginContext(options, ctx.inner(), plugin, pluginContextData, ctx, id, code), code, id, meta);
|
|
888
|
+
const [handler, meta] = normalizeHook(hook);
|
|
889
|
+
return [async (ctx, code, id, meta$1) => {
|
|
890
|
+
const ret = await handler.call(new TransformPluginContext(options, ctx.inner(), plugin, pluginContextData, ctx, id, code), code, id, meta$1);
|
|
874
891
|
if (ret == null) {
|
|
875
892
|
return undefined;
|
|
876
893
|
}
|
|
@@ -887,15 +904,15 @@ function bindingifyTransform(plugin, options, pluginContextData) {
|
|
|
887
904
|
sideEffects: bindingifySideEffects(ret.moduleSideEffects),
|
|
888
905
|
moduleType: ret.moduleType
|
|
889
906
|
};
|
|
890
|
-
};
|
|
907
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
891
908
|
}
|
|
892
909
|
function bindingifyLoad(plugin, options, pluginContextData) {
|
|
893
910
|
const hook = plugin.load;
|
|
894
911
|
if (!hook) {
|
|
895
|
-
return undefined;
|
|
912
|
+
return [undefined, undefined];
|
|
896
913
|
}
|
|
897
|
-
const [handler,
|
|
898
|
-
return async (ctx, id) => {
|
|
914
|
+
const [handler, meta] = normalizeHook(hook);
|
|
915
|
+
return [async (ctx, id) => {
|
|
899
916
|
const ret = await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), id);
|
|
900
917
|
if (ret == null) {
|
|
901
918
|
return;
|
|
@@ -924,17 +941,17 @@ function bindingifyLoad(plugin, options, pluginContextData) {
|
|
|
924
941
|
moduleSideEffects: ret.moduleSideEffects || null
|
|
925
942
|
});
|
|
926
943
|
return result;
|
|
927
|
-
};
|
|
944
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
928
945
|
}
|
|
929
946
|
function bindingifyModuleParsed(plugin, options, pluginContextData) {
|
|
930
947
|
const hook = plugin.moduleParsed;
|
|
931
948
|
if (!hook) {
|
|
932
|
-
return undefined;
|
|
949
|
+
return [undefined, undefined];
|
|
933
950
|
}
|
|
934
|
-
const [handler,
|
|
935
|
-
return async (ctx, moduleInfo) => {
|
|
951
|
+
const [handler, meta] = normalizeHook(hook);
|
|
952
|
+
return [async (ctx, moduleInfo) => {
|
|
936
953
|
await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), transformModuleInfo(moduleInfo, pluginContextData.moduleOptionMap.get(moduleInfo.id)));
|
|
937
|
-
};
|
|
954
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
938
955
|
}
|
|
939
956
|
|
|
940
957
|
//#endregion
|
|
@@ -942,20 +959,20 @@ function bindingifyModuleParsed(plugin, options, pluginContextData) {
|
|
|
942
959
|
function bindingifyRenderStart(plugin, options, outputOptions, pluginContextData) {
|
|
943
960
|
const hook = plugin.renderStart;
|
|
944
961
|
if (!hook) {
|
|
945
|
-
return undefined;
|
|
962
|
+
return [undefined, undefined];
|
|
946
963
|
}
|
|
947
|
-
const [handler,
|
|
948
|
-
return async (ctx) => {
|
|
964
|
+
const [handler, meta] = normalizeHook(hook);
|
|
965
|
+
return [async (ctx) => {
|
|
949
966
|
handler.call(new PluginContext(options, ctx, plugin, pluginContextData), outputOptions, options);
|
|
950
|
-
};
|
|
967
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
951
968
|
}
|
|
952
969
|
function bindingifyRenderChunk(plugin, options, outputOptions, pluginContextData) {
|
|
953
970
|
const hook = plugin.renderChunk;
|
|
954
971
|
if (!hook) {
|
|
955
|
-
return undefined;
|
|
972
|
+
return [undefined, undefined];
|
|
956
973
|
}
|
|
957
|
-
const [handler,
|
|
958
|
-
return async (ctx, code, chunk) => {
|
|
974
|
+
const [handler, meta] = normalizeHook(hook);
|
|
975
|
+
return [async (ctx, code, chunk) => {
|
|
959
976
|
const ret = await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), code, chunk, outputOptions);
|
|
960
977
|
if (ret == null) {
|
|
961
978
|
return;
|
|
@@ -970,123 +987,157 @@ function bindingifyRenderChunk(plugin, options, outputOptions, pluginContextData
|
|
|
970
987
|
code: ret.code,
|
|
971
988
|
map: bindingifySourcemap(ret.map)
|
|
972
989
|
};
|
|
973
|
-
};
|
|
990
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
974
991
|
}
|
|
975
992
|
function bindingifyAugmentChunkHash(plugin, options, pluginContextData) {
|
|
976
993
|
const hook = plugin.augmentChunkHash;
|
|
977
994
|
if (!hook) {
|
|
978
|
-
return undefined;
|
|
995
|
+
return [undefined, undefined];
|
|
979
996
|
}
|
|
980
|
-
const [handler,
|
|
981
|
-
return async (ctx, chunk) => {
|
|
997
|
+
const [handler, meta] = normalizeHook(hook);
|
|
998
|
+
return [async (ctx, chunk) => {
|
|
982
999
|
return await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), chunk);
|
|
983
|
-
};
|
|
1000
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
984
1001
|
}
|
|
985
1002
|
function bindingifyRenderError(plugin, options, pluginContextData) {
|
|
986
1003
|
const hook = plugin.renderError;
|
|
987
1004
|
if (!hook) {
|
|
988
|
-
return undefined;
|
|
1005
|
+
return [undefined, undefined];
|
|
989
1006
|
}
|
|
990
|
-
const [handler,
|
|
991
|
-
return async (ctx, err) => {
|
|
1007
|
+
const [handler, meta] = normalizeHook(hook);
|
|
1008
|
+
return [async (ctx, err) => {
|
|
992
1009
|
handler.call(new PluginContext(options, ctx, plugin, pluginContextData), new Error(err));
|
|
993
|
-
};
|
|
1010
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
994
1011
|
}
|
|
995
1012
|
function bindingifyGenerateBundle(plugin, options, outputOptions, pluginContextData) {
|
|
996
1013
|
const hook = plugin.generateBundle;
|
|
997
1014
|
if (!hook) {
|
|
998
|
-
return undefined;
|
|
1015
|
+
return [undefined, undefined];
|
|
999
1016
|
}
|
|
1000
|
-
const [handler,
|
|
1001
|
-
return async (ctx, bundle, isWrite) => {
|
|
1017
|
+
const [handler, meta] = normalizeHook(hook);
|
|
1018
|
+
return [async (ctx, bundle, isWrite) => {
|
|
1002
1019
|
await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), outputOptions, transformToOutputBundle(bundle), isWrite);
|
|
1003
|
-
};
|
|
1020
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
1004
1021
|
}
|
|
1005
1022
|
function bindingifyWriteBundle(plugin, options, outputOptions, pluginContextData) {
|
|
1006
1023
|
const hook = plugin.writeBundle;
|
|
1007
1024
|
if (!hook) {
|
|
1008
|
-
return undefined;
|
|
1025
|
+
return [undefined, undefined];
|
|
1009
1026
|
}
|
|
1010
|
-
const [handler,
|
|
1011
|
-
return async (ctx, bundle) => {
|
|
1027
|
+
const [handler, meta] = normalizeHook(hook);
|
|
1028
|
+
return [async (ctx, bundle) => {
|
|
1012
1029
|
await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), outputOptions, transformToOutputBundle(bundle));
|
|
1013
|
-
};
|
|
1030
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
1014
1031
|
}
|
|
1015
1032
|
function bindingifyBanner(plugin, options, pluginContextData) {
|
|
1016
1033
|
const hook = plugin.banner;
|
|
1017
1034
|
if (!hook) {
|
|
1018
|
-
return undefined;
|
|
1035
|
+
return [undefined, undefined];
|
|
1019
1036
|
}
|
|
1020
|
-
const [handler,
|
|
1021
|
-
return async (ctx, chunk) => {
|
|
1037
|
+
const [handler, meta] = normalizeHook(hook);
|
|
1038
|
+
return [async (ctx, chunk) => {
|
|
1022
1039
|
if (typeof handler === "string") {
|
|
1023
1040
|
return handler;
|
|
1024
1041
|
}
|
|
1025
1042
|
return handler.call(new PluginContext(options, ctx, plugin, pluginContextData), chunk);
|
|
1026
|
-
};
|
|
1043
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
1027
1044
|
}
|
|
1028
1045
|
function bindingifyFooter(plugin, options, pluginContextData) {
|
|
1029
1046
|
const hook = plugin.footer;
|
|
1030
1047
|
if (!hook) {
|
|
1031
|
-
return undefined;
|
|
1048
|
+
return [undefined, undefined];
|
|
1032
1049
|
}
|
|
1033
|
-
const [handler,
|
|
1034
|
-
return async (ctx, chunk) => {
|
|
1050
|
+
const [handler, meta] = normalizeHook(hook);
|
|
1051
|
+
return [async (ctx, chunk) => {
|
|
1035
1052
|
if (typeof handler === "string") {
|
|
1036
1053
|
return handler;
|
|
1037
1054
|
}
|
|
1038
1055
|
return handler.call(new PluginContext(options, ctx, plugin, pluginContextData), chunk);
|
|
1039
|
-
};
|
|
1056
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
1040
1057
|
}
|
|
1041
1058
|
function bindingifyIntro(plugin, options, pluginContextData) {
|
|
1042
1059
|
const hook = plugin.intro;
|
|
1043
1060
|
if (!hook) {
|
|
1044
|
-
return undefined;
|
|
1061
|
+
return [undefined, undefined];
|
|
1045
1062
|
}
|
|
1046
|
-
const [handler,
|
|
1047
|
-
return async (ctx, chunk) => {
|
|
1063
|
+
const [handler, meta] = normalizeHook(hook);
|
|
1064
|
+
return [async (ctx, chunk) => {
|
|
1048
1065
|
if (typeof handler === "string") {
|
|
1049
1066
|
return handler;
|
|
1050
1067
|
}
|
|
1051
1068
|
return handler.call(new PluginContext(options, ctx, plugin, pluginContextData), chunk);
|
|
1052
|
-
};
|
|
1069
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
1053
1070
|
}
|
|
1054
1071
|
function bindingifyOutro(plugin, options, pluginContextData) {
|
|
1055
1072
|
const hook = plugin.outro;
|
|
1056
1073
|
if (!hook) {
|
|
1057
|
-
return undefined;
|
|
1074
|
+
return [undefined, undefined];
|
|
1058
1075
|
}
|
|
1059
|
-
const [handler,
|
|
1060
|
-
return async (ctx, chunk) => {
|
|
1076
|
+
const [handler, meta] = normalizeHook(hook);
|
|
1077
|
+
return [async (ctx, chunk) => {
|
|
1061
1078
|
if (typeof handler === "string") {
|
|
1062
1079
|
return handler;
|
|
1063
1080
|
}
|
|
1064
1081
|
return handler.call(new PluginContext(options, ctx, plugin, pluginContextData), chunk);
|
|
1065
|
-
};
|
|
1082
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
1066
1083
|
}
|
|
1067
1084
|
|
|
1068
1085
|
//#endregion
|
|
1069
1086
|
//#region src/plugin/bindingify-plugin.ts
|
|
1070
1087
|
function bindingifyPlugin(plugin, options, outputOptions, pluginContextData) {
|
|
1088
|
+
const [buildStart, buildStartMeta] = bindingifyBuildStart(plugin, options, pluginContextData);
|
|
1089
|
+
const [resolveId, resolveIdMeta] = bindingifyResolveId(plugin, options, pluginContextData);
|
|
1090
|
+
const [resolveDynamicImport, resolveDynamicImportMeta] = bindingifyResolveDynamicImport(plugin, options, pluginContextData);
|
|
1091
|
+
const [buildEnd, buildEndMeta] = bindingifyBuildEnd(plugin, options, pluginContextData);
|
|
1092
|
+
const [transform, transformMeta] = bindingifyTransform(plugin, options, pluginContextData);
|
|
1093
|
+
const [moduleParsed, moduleParsedMeta] = bindingifyModuleParsed(plugin, options, pluginContextData);
|
|
1094
|
+
const [load, loadMeta] = bindingifyLoad(plugin, options, pluginContextData);
|
|
1095
|
+
const [renderChunk, renderChunkMeta] = bindingifyRenderChunk(plugin, options, outputOptions, pluginContextData);
|
|
1096
|
+
const [augmentChunkHash, augmentChunkHashMeta] = bindingifyAugmentChunkHash(plugin, options, pluginContextData);
|
|
1097
|
+
const [renderStart, renderStartMeta] = bindingifyRenderStart(plugin, options, outputOptions, pluginContextData);
|
|
1098
|
+
const [renderError, renderErrorMeta] = bindingifyRenderError(plugin, options, pluginContextData);
|
|
1099
|
+
const [generateBundle, generateBundleMeta] = bindingifyGenerateBundle(plugin, options, outputOptions, pluginContextData);
|
|
1100
|
+
const [writeBundle, writeBundleMeta] = bindingifyWriteBundle(plugin, options, outputOptions, pluginContextData);
|
|
1101
|
+
const [banner, bannerMeta] = bindingifyBanner(plugin, options, pluginContextData);
|
|
1102
|
+
const [footer, footerMeta] = bindingifyFooter(plugin, options, pluginContextData);
|
|
1103
|
+
const [intro, introMeta] = bindingifyIntro(plugin, options, pluginContextData);
|
|
1104
|
+
const [outro, outroMeta] = bindingifyOutro(plugin, options, pluginContextData);
|
|
1071
1105
|
return {
|
|
1072
1106
|
name: plugin.name ?? "unknown",
|
|
1073
|
-
buildStart
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1107
|
+
buildStart,
|
|
1108
|
+
buildStartMeta,
|
|
1109
|
+
resolveId,
|
|
1110
|
+
resolveIdMeta,
|
|
1111
|
+
resolveDynamicImport,
|
|
1112
|
+
resolveDynamicImportMeta,
|
|
1113
|
+
buildEnd,
|
|
1114
|
+
buildEndMeta,
|
|
1115
|
+
transform,
|
|
1116
|
+
transformMeta,
|
|
1117
|
+
moduleParsed,
|
|
1118
|
+
moduleParsedMeta,
|
|
1119
|
+
load,
|
|
1120
|
+
loadMeta,
|
|
1121
|
+
renderChunk,
|
|
1122
|
+
renderChunkMeta,
|
|
1123
|
+
augmentChunkHash,
|
|
1124
|
+
augmentChunkHashMeta,
|
|
1125
|
+
renderStart,
|
|
1126
|
+
renderStartMeta,
|
|
1127
|
+
renderError,
|
|
1128
|
+
renderErrorMeta,
|
|
1129
|
+
generateBundle,
|
|
1130
|
+
generateBundleMeta,
|
|
1131
|
+
writeBundle,
|
|
1132
|
+
writeBundleMeta,
|
|
1133
|
+
banner,
|
|
1134
|
+
bannerMeta,
|
|
1135
|
+
footer,
|
|
1136
|
+
footerMeta,
|
|
1137
|
+
intro,
|
|
1138
|
+
introMeta,
|
|
1139
|
+
outro,
|
|
1140
|
+
outroMeta
|
|
1090
1141
|
};
|
|
1091
1142
|
}
|
|
1092
1143
|
|
|
@@ -449,6 +449,7 @@ var require_binding = __commonJSMin((exports, module) => {
|
|
|
449
449
|
module.exports.BindingBuiltinPluginName = nativeBinding.BindingBuiltinPluginName;
|
|
450
450
|
module.exports.BindingHookSideEffects = nativeBinding.BindingHookSideEffects;
|
|
451
451
|
module.exports.BindingLogLevel = nativeBinding.BindingLogLevel;
|
|
452
|
+
module.exports.BindingPluginOrder = nativeBinding.BindingPluginOrder;
|
|
452
453
|
module.exports.isolatedDeclaration = nativeBinding.isolatedDeclaration;
|
|
453
454
|
module.exports.registerPlugins = nativeBinding.registerPlugins;
|
|
454
455
|
module.exports.transform = nativeBinding.transform;
|
|
@@ -801,47 +802,63 @@ class TransformPluginContext extends PluginContext {
|
|
|
801
802
|
|
|
802
803
|
//#endregion
|
|
803
804
|
//#region src/utils/transform-side-effects.ts
|
|
804
|
-
var import_binding = __toESM(require_binding());
|
|
805
|
+
var import_binding$1 = __toESM(require_binding());
|
|
805
806
|
function bindingifySideEffects(sideEffects) {
|
|
806
807
|
switch (sideEffects) {
|
|
807
|
-
case true: return import_binding.BindingHookSideEffects.True;
|
|
808
|
-
case false: return import_binding.BindingHookSideEffects.False;
|
|
809
|
-
case "no-treeshake": return import_binding.BindingHookSideEffects.NoTreeshake;
|
|
808
|
+
case true: return import_binding$1.BindingHookSideEffects.True;
|
|
809
|
+
case false: return import_binding$1.BindingHookSideEffects.False;
|
|
810
|
+
case "no-treeshake": return import_binding$1.BindingHookSideEffects.NoTreeshake;
|
|
810
811
|
case null:
|
|
811
812
|
case undefined: return undefined;
|
|
812
813
|
default: throw new Error(`Unexpected side effects: ${sideEffects}`);
|
|
813
814
|
}
|
|
814
815
|
}
|
|
815
816
|
|
|
817
|
+
//#endregion
|
|
818
|
+
//#region src/plugin/bindingify-plugin-hook-meta.ts
|
|
819
|
+
var import_binding = __toESM(require_binding());
|
|
820
|
+
function bindingifyPluginHookMeta(options) {
|
|
821
|
+
return {order: bindingPluginOrder(options.order)};
|
|
822
|
+
}
|
|
823
|
+
function bindingPluginOrder(order) {
|
|
824
|
+
switch (order) {
|
|
825
|
+
case "post": return import_binding.BindingPluginOrder.Post;
|
|
826
|
+
case "pre": return import_binding.BindingPluginOrder.Pre;
|
|
827
|
+
case null:
|
|
828
|
+
case undefined: return undefined;
|
|
829
|
+
default: throw new Error(`Unknown plugin order: ${order}`);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
|
|
816
833
|
//#endregion
|
|
817
834
|
//#region src/plugin/bindingify-build-hooks.ts
|
|
818
835
|
function bindingifyBuildStart(plugin, options, pluginContextData) {
|
|
819
836
|
const hook = plugin.buildStart;
|
|
820
837
|
if (!hook) {
|
|
821
|
-
return undefined;
|
|
838
|
+
return [undefined, undefined];
|
|
822
839
|
}
|
|
823
|
-
const [handler,
|
|
824
|
-
return async (ctx) => {
|
|
840
|
+
const [handler, meta] = normalizeHook(hook);
|
|
841
|
+
return [async (ctx) => {
|
|
825
842
|
await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), options);
|
|
826
|
-
};
|
|
843
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
827
844
|
}
|
|
828
845
|
function bindingifyBuildEnd(plugin, options, pluginContextData) {
|
|
829
846
|
const hook = plugin.buildEnd;
|
|
830
847
|
if (!hook) {
|
|
831
|
-
return undefined;
|
|
848
|
+
return [undefined, undefined];
|
|
832
849
|
}
|
|
833
|
-
const [handler,
|
|
834
|
-
return async (ctx, err) => {
|
|
850
|
+
const [handler, meta] = normalizeHook(hook);
|
|
851
|
+
return [async (ctx, err) => {
|
|
835
852
|
await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), err ? new Error(err) : undefined);
|
|
836
|
-
};
|
|
853
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
837
854
|
}
|
|
838
855
|
function bindingifyResolveId(plugin, options, pluginContextData) {
|
|
839
856
|
const hook = plugin.resolveId;
|
|
840
857
|
if (!hook) {
|
|
841
|
-
return undefined;
|
|
858
|
+
return [undefined, undefined];
|
|
842
859
|
}
|
|
843
|
-
const [handler,
|
|
844
|
-
return async (ctx, specifier, importer, extraOptions) => {
|
|
860
|
+
const [handler, meta] = normalizeHook(hook);
|
|
861
|
+
return [async (ctx, specifier, importer, extraOptions) => {
|
|
845
862
|
const ret = await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), specifier, importer ?? undefined, {
|
|
846
863
|
...extraOptions,
|
|
847
864
|
custom: typeof extraOptions.custom === "number" ? pluginContextData.getResolveCustom(extraOptions.custom) : undefined
|
|
@@ -864,15 +881,15 @@ function bindingifyResolveId(plugin, options, pluginContextData) {
|
|
|
864
881
|
moduleSideEffects: ret.moduleSideEffects || null
|
|
865
882
|
});
|
|
866
883
|
return result;
|
|
867
|
-
};
|
|
884
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
868
885
|
}
|
|
869
886
|
function bindingifyResolveDynamicImport(plugin, options, pluginContextData) {
|
|
870
887
|
const hook = plugin.resolveDynamicImport;
|
|
871
888
|
if (!hook) {
|
|
872
|
-
return undefined;
|
|
889
|
+
return [undefined, undefined];
|
|
873
890
|
}
|
|
874
|
-
const [handler,
|
|
875
|
-
return async (ctx, specifier, importer) => {
|
|
891
|
+
const [handler, meta] = normalizeHook(hook);
|
|
892
|
+
return [async (ctx, specifier, importer) => {
|
|
876
893
|
const ret = await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), specifier, importer ?? undefined);
|
|
877
894
|
if (ret == false || ret == null) {
|
|
878
895
|
return;
|
|
@@ -892,16 +909,16 @@ function bindingifyResolveDynamicImport(plugin, options, pluginContextData) {
|
|
|
892
909
|
moduleSideEffects: ret.moduleSideEffects || null
|
|
893
910
|
});
|
|
894
911
|
return result;
|
|
895
|
-
};
|
|
912
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
896
913
|
}
|
|
897
914
|
function bindingifyTransform(plugin, options, pluginContextData) {
|
|
898
915
|
const hook = plugin.transform;
|
|
899
916
|
if (!hook) {
|
|
900
|
-
return undefined;
|
|
917
|
+
return [undefined, undefined];
|
|
901
918
|
}
|
|
902
|
-
const [handler,
|
|
903
|
-
return async (ctx, code, id, meta) => {
|
|
904
|
-
const ret = await handler.call(new TransformPluginContext(options, ctx.inner(), plugin, pluginContextData, ctx, id, code), code, id, meta);
|
|
919
|
+
const [handler, meta] = normalizeHook(hook);
|
|
920
|
+
return [async (ctx, code, id, meta$1) => {
|
|
921
|
+
const ret = await handler.call(new TransformPluginContext(options, ctx.inner(), plugin, pluginContextData, ctx, id, code), code, id, meta$1);
|
|
905
922
|
if (ret == null) {
|
|
906
923
|
return undefined;
|
|
907
924
|
}
|
|
@@ -918,15 +935,15 @@ function bindingifyTransform(plugin, options, pluginContextData) {
|
|
|
918
935
|
sideEffects: bindingifySideEffects(ret.moduleSideEffects),
|
|
919
936
|
moduleType: ret.moduleType
|
|
920
937
|
};
|
|
921
|
-
};
|
|
938
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
922
939
|
}
|
|
923
940
|
function bindingifyLoad(plugin, options, pluginContextData) {
|
|
924
941
|
const hook = plugin.load;
|
|
925
942
|
if (!hook) {
|
|
926
|
-
return undefined;
|
|
943
|
+
return [undefined, undefined];
|
|
927
944
|
}
|
|
928
|
-
const [handler,
|
|
929
|
-
return async (ctx, id) => {
|
|
945
|
+
const [handler, meta] = normalizeHook(hook);
|
|
946
|
+
return [async (ctx, id) => {
|
|
930
947
|
const ret = await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), id);
|
|
931
948
|
if (ret == null) {
|
|
932
949
|
return;
|
|
@@ -955,17 +972,17 @@ function bindingifyLoad(plugin, options, pluginContextData) {
|
|
|
955
972
|
moduleSideEffects: ret.moduleSideEffects || null
|
|
956
973
|
});
|
|
957
974
|
return result;
|
|
958
|
-
};
|
|
975
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
959
976
|
}
|
|
960
977
|
function bindingifyModuleParsed(plugin, options, pluginContextData) {
|
|
961
978
|
const hook = plugin.moduleParsed;
|
|
962
979
|
if (!hook) {
|
|
963
|
-
return undefined;
|
|
980
|
+
return [undefined, undefined];
|
|
964
981
|
}
|
|
965
|
-
const [handler,
|
|
966
|
-
return async (ctx, moduleInfo) => {
|
|
982
|
+
const [handler, meta] = normalizeHook(hook);
|
|
983
|
+
return [async (ctx, moduleInfo) => {
|
|
967
984
|
await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), transformModuleInfo(moduleInfo, pluginContextData.moduleOptionMap.get(moduleInfo.id)));
|
|
968
|
-
};
|
|
985
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
969
986
|
}
|
|
970
987
|
|
|
971
988
|
//#endregion
|
|
@@ -973,20 +990,20 @@ function bindingifyModuleParsed(plugin, options, pluginContextData) {
|
|
|
973
990
|
function bindingifyRenderStart(plugin, options, outputOptions, pluginContextData) {
|
|
974
991
|
const hook = plugin.renderStart;
|
|
975
992
|
if (!hook) {
|
|
976
|
-
return undefined;
|
|
993
|
+
return [undefined, undefined];
|
|
977
994
|
}
|
|
978
|
-
const [handler,
|
|
979
|
-
return async (ctx) => {
|
|
995
|
+
const [handler, meta] = normalizeHook(hook);
|
|
996
|
+
return [async (ctx) => {
|
|
980
997
|
handler.call(new PluginContext(options, ctx, plugin, pluginContextData), outputOptions, options);
|
|
981
|
-
};
|
|
998
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
982
999
|
}
|
|
983
1000
|
function bindingifyRenderChunk(plugin, options, outputOptions, pluginContextData) {
|
|
984
1001
|
const hook = plugin.renderChunk;
|
|
985
1002
|
if (!hook) {
|
|
986
|
-
return undefined;
|
|
1003
|
+
return [undefined, undefined];
|
|
987
1004
|
}
|
|
988
|
-
const [handler,
|
|
989
|
-
return async (ctx, code, chunk) => {
|
|
1005
|
+
const [handler, meta] = normalizeHook(hook);
|
|
1006
|
+
return [async (ctx, code, chunk) => {
|
|
990
1007
|
const ret = await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), code, chunk, outputOptions);
|
|
991
1008
|
if (ret == null) {
|
|
992
1009
|
return;
|
|
@@ -1001,123 +1018,157 @@ function bindingifyRenderChunk(plugin, options, outputOptions, pluginContextData
|
|
|
1001
1018
|
code: ret.code,
|
|
1002
1019
|
map: bindingifySourcemap(ret.map)
|
|
1003
1020
|
};
|
|
1004
|
-
};
|
|
1021
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
1005
1022
|
}
|
|
1006
1023
|
function bindingifyAugmentChunkHash(plugin, options, pluginContextData) {
|
|
1007
1024
|
const hook = plugin.augmentChunkHash;
|
|
1008
1025
|
if (!hook) {
|
|
1009
|
-
return undefined;
|
|
1026
|
+
return [undefined, undefined];
|
|
1010
1027
|
}
|
|
1011
|
-
const [handler,
|
|
1012
|
-
return async (ctx, chunk) => {
|
|
1028
|
+
const [handler, meta] = normalizeHook(hook);
|
|
1029
|
+
return [async (ctx, chunk) => {
|
|
1013
1030
|
return await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), chunk);
|
|
1014
|
-
};
|
|
1031
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
1015
1032
|
}
|
|
1016
1033
|
function bindingifyRenderError(plugin, options, pluginContextData) {
|
|
1017
1034
|
const hook = plugin.renderError;
|
|
1018
1035
|
if (!hook) {
|
|
1019
|
-
return undefined;
|
|
1036
|
+
return [undefined, undefined];
|
|
1020
1037
|
}
|
|
1021
|
-
const [handler,
|
|
1022
|
-
return async (ctx, err) => {
|
|
1038
|
+
const [handler, meta] = normalizeHook(hook);
|
|
1039
|
+
return [async (ctx, err) => {
|
|
1023
1040
|
handler.call(new PluginContext(options, ctx, plugin, pluginContextData), new Error(err));
|
|
1024
|
-
};
|
|
1041
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
1025
1042
|
}
|
|
1026
1043
|
function bindingifyGenerateBundle(plugin, options, outputOptions, pluginContextData) {
|
|
1027
1044
|
const hook = plugin.generateBundle;
|
|
1028
1045
|
if (!hook) {
|
|
1029
|
-
return undefined;
|
|
1046
|
+
return [undefined, undefined];
|
|
1030
1047
|
}
|
|
1031
|
-
const [handler,
|
|
1032
|
-
return async (ctx, bundle, isWrite) => {
|
|
1048
|
+
const [handler, meta] = normalizeHook(hook);
|
|
1049
|
+
return [async (ctx, bundle, isWrite) => {
|
|
1033
1050
|
await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), outputOptions, transformToOutputBundle(bundle), isWrite);
|
|
1034
|
-
};
|
|
1051
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
1035
1052
|
}
|
|
1036
1053
|
function bindingifyWriteBundle(plugin, options, outputOptions, pluginContextData) {
|
|
1037
1054
|
const hook = plugin.writeBundle;
|
|
1038
1055
|
if (!hook) {
|
|
1039
|
-
return undefined;
|
|
1056
|
+
return [undefined, undefined];
|
|
1040
1057
|
}
|
|
1041
|
-
const [handler,
|
|
1042
|
-
return async (ctx, bundle) => {
|
|
1058
|
+
const [handler, meta] = normalizeHook(hook);
|
|
1059
|
+
return [async (ctx, bundle) => {
|
|
1043
1060
|
await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), outputOptions, transformToOutputBundle(bundle));
|
|
1044
|
-
};
|
|
1061
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
1045
1062
|
}
|
|
1046
1063
|
function bindingifyBanner(plugin, options, pluginContextData) {
|
|
1047
1064
|
const hook = plugin.banner;
|
|
1048
1065
|
if (!hook) {
|
|
1049
|
-
return undefined;
|
|
1066
|
+
return [undefined, undefined];
|
|
1050
1067
|
}
|
|
1051
|
-
const [handler,
|
|
1052
|
-
return async (ctx, chunk) => {
|
|
1068
|
+
const [handler, meta] = normalizeHook(hook);
|
|
1069
|
+
return [async (ctx, chunk) => {
|
|
1053
1070
|
if (typeof handler === "string") {
|
|
1054
1071
|
return handler;
|
|
1055
1072
|
}
|
|
1056
1073
|
return handler.call(new PluginContext(options, ctx, plugin, pluginContextData), chunk);
|
|
1057
|
-
};
|
|
1074
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
1058
1075
|
}
|
|
1059
1076
|
function bindingifyFooter(plugin, options, pluginContextData) {
|
|
1060
1077
|
const hook = plugin.footer;
|
|
1061
1078
|
if (!hook) {
|
|
1062
|
-
return undefined;
|
|
1079
|
+
return [undefined, undefined];
|
|
1063
1080
|
}
|
|
1064
|
-
const [handler,
|
|
1065
|
-
return async (ctx, chunk) => {
|
|
1081
|
+
const [handler, meta] = normalizeHook(hook);
|
|
1082
|
+
return [async (ctx, chunk) => {
|
|
1066
1083
|
if (typeof handler === "string") {
|
|
1067
1084
|
return handler;
|
|
1068
1085
|
}
|
|
1069
1086
|
return handler.call(new PluginContext(options, ctx, plugin, pluginContextData), chunk);
|
|
1070
|
-
};
|
|
1087
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
1071
1088
|
}
|
|
1072
1089
|
function bindingifyIntro(plugin, options, pluginContextData) {
|
|
1073
1090
|
const hook = plugin.intro;
|
|
1074
1091
|
if (!hook) {
|
|
1075
|
-
return undefined;
|
|
1092
|
+
return [undefined, undefined];
|
|
1076
1093
|
}
|
|
1077
|
-
const [handler,
|
|
1078
|
-
return async (ctx, chunk) => {
|
|
1094
|
+
const [handler, meta] = normalizeHook(hook);
|
|
1095
|
+
return [async (ctx, chunk) => {
|
|
1079
1096
|
if (typeof handler === "string") {
|
|
1080
1097
|
return handler;
|
|
1081
1098
|
}
|
|
1082
1099
|
return handler.call(new PluginContext(options, ctx, plugin, pluginContextData), chunk);
|
|
1083
|
-
};
|
|
1100
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
1084
1101
|
}
|
|
1085
1102
|
function bindingifyOutro(plugin, options, pluginContextData) {
|
|
1086
1103
|
const hook = plugin.outro;
|
|
1087
1104
|
if (!hook) {
|
|
1088
|
-
return undefined;
|
|
1105
|
+
return [undefined, undefined];
|
|
1089
1106
|
}
|
|
1090
|
-
const [handler,
|
|
1091
|
-
return async (ctx, chunk) => {
|
|
1107
|
+
const [handler, meta] = normalizeHook(hook);
|
|
1108
|
+
return [async (ctx, chunk) => {
|
|
1092
1109
|
if (typeof handler === "string") {
|
|
1093
1110
|
return handler;
|
|
1094
1111
|
}
|
|
1095
1112
|
return handler.call(new PluginContext(options, ctx, plugin, pluginContextData), chunk);
|
|
1096
|
-
};
|
|
1113
|
+
}, bindingifyPluginHookMeta(meta),];
|
|
1097
1114
|
}
|
|
1098
1115
|
|
|
1099
1116
|
//#endregion
|
|
1100
1117
|
//#region src/plugin/bindingify-plugin.ts
|
|
1101
1118
|
function bindingifyPlugin(plugin, options, outputOptions, pluginContextData) {
|
|
1119
|
+
const [buildStart, buildStartMeta] = bindingifyBuildStart(plugin, options, pluginContextData);
|
|
1120
|
+
const [resolveId, resolveIdMeta] = bindingifyResolveId(plugin, options, pluginContextData);
|
|
1121
|
+
const [resolveDynamicImport, resolveDynamicImportMeta] = bindingifyResolveDynamicImport(plugin, options, pluginContextData);
|
|
1122
|
+
const [buildEnd, buildEndMeta] = bindingifyBuildEnd(plugin, options, pluginContextData);
|
|
1123
|
+
const [transform, transformMeta] = bindingifyTransform(plugin, options, pluginContextData);
|
|
1124
|
+
const [moduleParsed, moduleParsedMeta] = bindingifyModuleParsed(plugin, options, pluginContextData);
|
|
1125
|
+
const [load, loadMeta] = bindingifyLoad(plugin, options, pluginContextData);
|
|
1126
|
+
const [renderChunk, renderChunkMeta] = bindingifyRenderChunk(plugin, options, outputOptions, pluginContextData);
|
|
1127
|
+
const [augmentChunkHash, augmentChunkHashMeta] = bindingifyAugmentChunkHash(plugin, options, pluginContextData);
|
|
1128
|
+
const [renderStart, renderStartMeta] = bindingifyRenderStart(plugin, options, outputOptions, pluginContextData);
|
|
1129
|
+
const [renderError, renderErrorMeta] = bindingifyRenderError(plugin, options, pluginContextData);
|
|
1130
|
+
const [generateBundle, generateBundleMeta] = bindingifyGenerateBundle(plugin, options, outputOptions, pluginContextData);
|
|
1131
|
+
const [writeBundle, writeBundleMeta] = bindingifyWriteBundle(plugin, options, outputOptions, pluginContextData);
|
|
1132
|
+
const [banner, bannerMeta] = bindingifyBanner(plugin, options, pluginContextData);
|
|
1133
|
+
const [footer, footerMeta] = bindingifyFooter(plugin, options, pluginContextData);
|
|
1134
|
+
const [intro, introMeta] = bindingifyIntro(plugin, options, pluginContextData);
|
|
1135
|
+
const [outro, outroMeta] = bindingifyOutro(plugin, options, pluginContextData);
|
|
1102
1136
|
return {
|
|
1103
1137
|
name: plugin.name ?? "unknown",
|
|
1104
|
-
buildStart
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1138
|
+
buildStart,
|
|
1139
|
+
buildStartMeta,
|
|
1140
|
+
resolveId,
|
|
1141
|
+
resolveIdMeta,
|
|
1142
|
+
resolveDynamicImport,
|
|
1143
|
+
resolveDynamicImportMeta,
|
|
1144
|
+
buildEnd,
|
|
1145
|
+
buildEndMeta,
|
|
1146
|
+
transform,
|
|
1147
|
+
transformMeta,
|
|
1148
|
+
moduleParsed,
|
|
1149
|
+
moduleParsedMeta,
|
|
1150
|
+
load,
|
|
1151
|
+
loadMeta,
|
|
1152
|
+
renderChunk,
|
|
1153
|
+
renderChunkMeta,
|
|
1154
|
+
augmentChunkHash,
|
|
1155
|
+
augmentChunkHashMeta,
|
|
1156
|
+
renderStart,
|
|
1157
|
+
renderStartMeta,
|
|
1158
|
+
renderError,
|
|
1159
|
+
renderErrorMeta,
|
|
1160
|
+
generateBundle,
|
|
1161
|
+
generateBundleMeta,
|
|
1162
|
+
writeBundle,
|
|
1163
|
+
writeBundleMeta,
|
|
1164
|
+
banner,
|
|
1165
|
+
bannerMeta,
|
|
1166
|
+
footer,
|
|
1167
|
+
footerMeta,
|
|
1168
|
+
intro,
|
|
1169
|
+
introMeta,
|
|
1170
|
+
outro,
|
|
1171
|
+
outroMeta
|
|
1121
1172
|
};
|
|
1122
1173
|
}
|
|
1123
1174
|
|
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
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-N8cNBCJA.mjs";
|
|
4
4
|
import { default as nodePath, default as path } from "node:path";
|
|
5
5
|
import { isRegExp, isRegExp as isRegExp$1 } from "node:util/types";
|
|
6
6
|
import { Worker } from "node:worker_threads";
|
|
@@ -123,26 +123,28 @@ function __napi_rs_initialize_modules(__napiInstance) {
|
|
|
123
123
|
__napiInstance.exports['__napi_register__BindingManifestPluginConfig_struct_38']?.()
|
|
124
124
|
__napiInstance.exports['__napi_register__BindingModulePreloadPolyfillPluginConfig_struct_39']?.()
|
|
125
125
|
__napiInstance.exports['__napi_register__BindingTransformPluginConfig_struct_40']?.()
|
|
126
|
-
__napiInstance.exports['
|
|
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['
|
|
126
|
+
__napiInstance.exports['__napi_register__BindingPluginOrder_41']?.()
|
|
127
|
+
__napiInstance.exports['__napi_register__BindingPluginHookMeta_struct_42']?.()
|
|
128
|
+
__napiInstance.exports['__napi_register__ParallelJsPluginRegistry_struct_43']?.()
|
|
129
|
+
__napiInstance.exports['__napi_register__ParallelJsPluginRegistry_impl_45']?.()
|
|
130
|
+
__napiInstance.exports['__napi_register__register_plugins_46']?.()
|
|
131
|
+
__napiInstance.exports['__napi_register__BindingLog_struct_47']?.()
|
|
132
|
+
__napiInstance.exports['__napi_register__BindingLogLevel_48']?.()
|
|
133
|
+
__napiInstance.exports['__napi_register__BindingModuleInfo_struct_49']?.()
|
|
134
|
+
__napiInstance.exports['__napi_register__BindingModuleInfo_impl_51']?.()
|
|
135
|
+
__napiInstance.exports['__napi_register__BindingOutputAsset_struct_52']?.()
|
|
136
|
+
__napiInstance.exports['__napi_register__BindingOutputAsset_impl_57']?.()
|
|
137
|
+
__napiInstance.exports['__napi_register__BindingOutputChunk_struct_58']?.()
|
|
138
|
+
__napiInstance.exports['__napi_register__BindingOutputChunk_impl_76']?.()
|
|
139
|
+
__napiInstance.exports['__napi_register__BindingOutputs_struct_77']?.()
|
|
140
|
+
__napiInstance.exports['__napi_register__BindingOutputs_impl_81']?.()
|
|
141
|
+
__napiInstance.exports['__napi_register__FinalBindingOutputs_struct_82']?.()
|
|
142
|
+
__napiInstance.exports['__napi_register__FinalBindingOutputs_impl_85']?.()
|
|
143
|
+
__napiInstance.exports['__napi_register__RenderedChunk_struct_86']?.()
|
|
144
|
+
__napiInstance.exports['__napi_register__BindingRenderedModule_struct_87']?.()
|
|
145
|
+
__napiInstance.exports['__napi_register__AliasItem_struct_88']?.()
|
|
146
|
+
__napiInstance.exports['__napi_register__BindingSourcemap_struct_89']?.()
|
|
147
|
+
__napiInstance.exports['__napi_register__BindingJsonSourcemap_struct_90']?.()
|
|
146
148
|
}
|
|
147
149
|
module.exports.BindingLog = __napiModule.exports.BindingLog
|
|
148
150
|
module.exports.BindingModuleInfo = __napiModule.exports.BindingModuleInfo
|
|
@@ -157,6 +159,7 @@ module.exports.ParallelJsPluginRegistry = __napiModule.exports.ParallelJsPluginR
|
|
|
157
159
|
module.exports.BindingBuiltinPluginName = __napiModule.exports.BindingBuiltinPluginName
|
|
158
160
|
module.exports.BindingHookSideEffects = __napiModule.exports.BindingHookSideEffects
|
|
159
161
|
module.exports.BindingLogLevel = __napiModule.exports.BindingLogLevel
|
|
162
|
+
module.exports.BindingPluginOrder = __napiModule.exports.BindingPluginOrder
|
|
160
163
|
module.exports.isolatedDeclaration = __napiModule.exports.isolatedDeclaration
|
|
161
164
|
module.exports.registerPlugins = __napiModule.exports.registerPlugins
|
|
162
165
|
module.exports.transform = __napiModule.exports.transform
|
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
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-1VeqieJQ.cjs");
|
|
5
5
|
const { default: nodePath, default: path } = __toESM(require("node:path"));
|
|
6
6
|
const { isRegExp, isRegExp: isRegExp$1 } = __toESM(require("node:util/types"));
|
|
7
7
|
const { Worker } = __toESM(require("node:worker_threads"));
|
package/dist/types/binding.d.ts
CHANGED
|
@@ -244,25 +244,51 @@ export interface BindingPluginContextResolveOptions {
|
|
|
244
244
|
custom?: number
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
+
export interface BindingPluginHookMeta {
|
|
248
|
+
order?: BindingPluginOrder
|
|
249
|
+
}
|
|
250
|
+
|
|
247
251
|
export interface BindingPluginOptions {
|
|
248
252
|
name: string
|
|
249
253
|
buildStart?: (ctx: BindingPluginContext) => MaybePromise<VoidNullable>
|
|
254
|
+
buildStartMeta?: BindingPluginHookMeta
|
|
250
255
|
resolveId?: (ctx: BindingPluginContext, specifier: string, importer: Nullable<string>, options: BindingHookResolveIdExtraArgs) => MaybePromise<VoidNullable<BindingHookResolveIdOutput>>
|
|
256
|
+
resolveIdMeta?: BindingPluginHookMeta
|
|
251
257
|
resolveDynamicImport?: (ctx: BindingPluginContext, specifier: string, importer: Nullable<string>) => MaybePromise<VoidNullable<BindingHookResolveIdOutput>>
|
|
258
|
+
resolveDynamicImportMeta?: BindingPluginHookMeta
|
|
252
259
|
load?: (ctx: BindingPluginContext, id: string) => MaybePromise<VoidNullable<BindingHookLoadOutput>>
|
|
260
|
+
loadMeta?: BindingPluginHookMeta
|
|
253
261
|
transform?: (ctx: BindingTransformPluginContext, id: string, code: string, module_type: BindingTransformHookExtraArgs) => MaybePromise<VoidNullable<BindingHookTransformOutput>>
|
|
262
|
+
transformMeta?: BindingPluginHookMeta
|
|
254
263
|
moduleParsed?: (ctx: BindingPluginContext, module: BindingModuleInfo) => MaybePromise<VoidNullable>
|
|
264
|
+
moduleParsedMeta?: BindingPluginHookMeta
|
|
255
265
|
buildEnd?: (ctx: BindingPluginContext, error: Nullable<string>) => MaybePromise<VoidNullable>
|
|
266
|
+
buildEndMeta?: BindingPluginHookMeta
|
|
256
267
|
renderChunk?: (ctx: BindingPluginContext, code: string, chunk: RenderedChunk) => MaybePromise<VoidNullable<BindingHookRenderChunkOutput>>
|
|
268
|
+
renderChunkMeta?: BindingPluginHookMeta
|
|
257
269
|
augmentChunkHash?: (ctx: BindingPluginContext, chunk: RenderedChunk) => MaybePromise<void | string>
|
|
270
|
+
augmentChunkHashMeta?: BindingPluginHookMeta
|
|
258
271
|
renderStart?: (ctx: BindingPluginContext) => void
|
|
272
|
+
renderStartMeta?: BindingPluginHookMeta
|
|
259
273
|
renderError?: (ctx: BindingPluginContext, error: string) => void
|
|
274
|
+
renderErrorMeta?: BindingPluginHookMeta
|
|
260
275
|
generateBundle?: (ctx: BindingPluginContext, bundle: BindingOutputs, isWrite: boolean) => MaybePromise<VoidNullable>
|
|
276
|
+
generateBundleMeta?: BindingPluginHookMeta
|
|
261
277
|
writeBundle?: (ctx: BindingPluginContext, bundle: BindingOutputs) => MaybePromise<VoidNullable>
|
|
278
|
+
writeBundleMeta?: BindingPluginHookMeta
|
|
262
279
|
banner?: (ctx: BindingPluginContext, chunk: RenderedChunk) => void
|
|
280
|
+
bannerMeta?: BindingPluginHookMeta
|
|
263
281
|
footer?: (ctx: BindingPluginContext, chunk: RenderedChunk) => void
|
|
282
|
+
footerMeta?: BindingPluginHookMeta
|
|
264
283
|
intro?: (ctx: BindingPluginContext, chunk: RenderedChunk) => void
|
|
284
|
+
introMeta?: BindingPluginHookMeta
|
|
265
285
|
outro?: (ctx: BindingPluginContext, chunk: RenderedChunk) => void
|
|
286
|
+
outroMeta?: BindingPluginHookMeta
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export declare enum BindingPluginOrder {
|
|
290
|
+
Pre = 0,
|
|
291
|
+
Post = 1
|
|
266
292
|
}
|
|
267
293
|
|
|
268
294
|
export interface BindingPluginWithIndex {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BindingTransformPluginConfig } from '../binding';
|
|
2
2
|
type TransformPattern = string | RegExp | RegExp[] | string[];
|
|
3
|
-
export type TransformPluginConfig = BindingTransformPluginConfig & {
|
|
3
|
+
export type TransformPluginConfig = Omit<BindingTransformPluginConfig, 'include' | 'exclude'> & {
|
|
4
4
|
include?: TransformPattern;
|
|
5
5
|
exclude?: TransformPattern;
|
|
6
6
|
};
|
|
@@ -2,10 +2,11 @@ import type { BindingPluginOptions } from '../binding';
|
|
|
2
2
|
import type { Plugin } from './index';
|
|
3
3
|
import { NormalizedInputOptions } from '../options/normalized-input-options';
|
|
4
4
|
import { PluginContextData } from './plugin-context-data';
|
|
5
|
-
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function
|
|
5
|
+
import { PluginHookWithBindingMeta } from './bindingify-plugin-hook-meta';
|
|
6
|
+
export declare function bindingifyBuildStart(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingMeta<BindingPluginOptions['buildStart']>;
|
|
7
|
+
export declare function bindingifyBuildEnd(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingMeta<BindingPluginOptions['buildEnd']>;
|
|
8
|
+
export declare function bindingifyResolveId(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingMeta<BindingPluginOptions['resolveId']>;
|
|
9
|
+
export declare function bindingifyResolveDynamicImport(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingMeta<BindingPluginOptions['resolveDynamicImport']>;
|
|
10
|
+
export declare function bindingifyTransform(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingMeta<BindingPluginOptions['transform']>;
|
|
11
|
+
export declare function bindingifyLoad(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingMeta<BindingPluginOptions['load']>;
|
|
12
|
+
export declare function bindingifyModuleParsed(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingMeta<BindingPluginOptions['moduleParsed']>;
|
|
@@ -3,13 +3,14 @@ import type { NormalizedInputOptions } from '../options/normalized-input-options
|
|
|
3
3
|
import type { Plugin } from './index';
|
|
4
4
|
import { NormalizedOutputOptions } from '../options/normalized-output-options';
|
|
5
5
|
import { PluginContextData } from './plugin-context-data';
|
|
6
|
-
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function
|
|
13
|
-
export declare function
|
|
14
|
-
export declare function
|
|
15
|
-
export declare function
|
|
6
|
+
import { PluginHookWithBindingMeta } from './bindingify-plugin-hook-meta';
|
|
7
|
+
export declare function bindingifyRenderStart(plugin: Plugin, options: NormalizedInputOptions, outputOptions: NormalizedOutputOptions, pluginContextData: PluginContextData): PluginHookWithBindingMeta<BindingPluginOptions['renderStart']>;
|
|
8
|
+
export declare function bindingifyRenderChunk(plugin: Plugin, options: NormalizedInputOptions, outputOptions: NormalizedOutputOptions, pluginContextData: PluginContextData): PluginHookWithBindingMeta<BindingPluginOptions['renderChunk']>;
|
|
9
|
+
export declare function bindingifyAugmentChunkHash(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingMeta<BindingPluginOptions['augmentChunkHash']>;
|
|
10
|
+
export declare function bindingifyRenderError(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingMeta<BindingPluginOptions['renderError']>;
|
|
11
|
+
export declare function bindingifyGenerateBundle(plugin: Plugin, options: NormalizedInputOptions, outputOptions: NormalizedOutputOptions, pluginContextData: PluginContextData): PluginHookWithBindingMeta<BindingPluginOptions['generateBundle']>;
|
|
12
|
+
export declare function bindingifyWriteBundle(plugin: Plugin, options: NormalizedInputOptions, outputOptions: NormalizedOutputOptions, pluginContextData: PluginContextData): PluginHookWithBindingMeta<BindingPluginOptions['writeBundle']>;
|
|
13
|
+
export declare function bindingifyBanner(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingMeta<BindingPluginOptions['banner']>;
|
|
14
|
+
export declare function bindingifyFooter(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingMeta<BindingPluginOptions['footer']>;
|
|
15
|
+
export declare function bindingifyIntro(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingMeta<BindingPluginOptions['intro']>;
|
|
16
|
+
export declare function bindingifyOutro(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingMeta<BindingPluginOptions['outro']>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ObjectHookMeta } from '.';
|
|
2
|
+
import { BindingPluginHookMeta } from '../binding';
|
|
3
|
+
export declare function bindingifyPluginHookMeta(options: ObjectHookMeta): BindingPluginHookMeta;
|
|
4
|
+
export type PluginHookWithBindingMeta<T> = [
|
|
5
|
+
T | undefined,
|
|
6
|
+
BindingPluginHookMeta | undefined
|
|
7
|
+
];
|
|
@@ -72,9 +72,13 @@ export interface FunctionPluginHooks {
|
|
|
72
72
|
generateBundle: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle, isWrite: boolean) => void;
|
|
73
73
|
writeBundle: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle) => void;
|
|
74
74
|
}
|
|
75
|
+
export type PluginOrder = 'pre' | 'post' | null;
|
|
76
|
+
export type ObjectHookMeta<O = {}> = {
|
|
77
|
+
order?: PluginOrder;
|
|
78
|
+
} & O;
|
|
75
79
|
export type ObjectHook<T, O = {}> = T | ({
|
|
76
80
|
handler: T;
|
|
77
|
-
} & O);
|
|
81
|
+
} & ObjectHookMeta<O>);
|
|
78
82
|
export type SyncPluginHooks = 'augmentChunkHash' | 'onLog' | 'outputOptions';
|
|
79
83
|
export type AsyncPluginHooks = Exclude<keyof FunctionPluginHooks, SyncPluginHooks>;
|
|
80
84
|
export type FirstPluginHooks = 'load' | 'renderDynamicImport' | 'resolveDynamicImport' | 'resolveId';
|
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-a2bb2ca-20240811003152",
|
|
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
|
"vitest": "^1.6.0",
|
|
103
103
|
"why-is-node-running": "^2.2.2",
|
|
104
104
|
"@rolldown/testing": "0.0.1",
|
|
105
|
-
"rolldown": "0.12.2-snapshot-
|
|
105
|
+
"rolldown": "0.12.2-snapshot-a2bb2ca-20240811003152"
|
|
106
106
|
},
|
|
107
107
|
"optionalDependencies": {
|
|
108
|
-
"@rolldown/binding-darwin-arm64": "0.12.2-snapshot-
|
|
109
|
-
"@rolldown/binding-
|
|
110
|
-
"@rolldown/binding-
|
|
111
|
-
"@rolldown/binding-
|
|
112
|
-
"@rolldown/binding-
|
|
113
|
-
"@rolldown/binding-linux-arm64-musl": "0.12.2-snapshot-
|
|
114
|
-
"@rolldown/binding-linux-x64-gnu": "0.12.2-snapshot-
|
|
115
|
-
"@rolldown/binding-wasm32-wasi": "0.12.2-snapshot-
|
|
116
|
-
"@rolldown/binding-
|
|
117
|
-
"@rolldown/binding-
|
|
118
|
-
"@rolldown/binding-win32-ia32-msvc": "0.12.2-snapshot-
|
|
119
|
-
"@rolldown/binding-win32-x64-msvc": "0.12.2-snapshot-
|
|
108
|
+
"@rolldown/binding-darwin-arm64": "0.12.2-snapshot-a2bb2ca-20240811003152",
|
|
109
|
+
"@rolldown/binding-linux-arm-gnueabihf": "0.12.2-snapshot-a2bb2ca-20240811003152",
|
|
110
|
+
"@rolldown/binding-darwin-x64": "0.12.2-snapshot-a2bb2ca-20240811003152",
|
|
111
|
+
"@rolldown/binding-linux-arm64-gnu": "0.12.2-snapshot-a2bb2ca-20240811003152",
|
|
112
|
+
"@rolldown/binding-freebsd-x64": "0.12.2-snapshot-a2bb2ca-20240811003152",
|
|
113
|
+
"@rolldown/binding-linux-arm64-musl": "0.12.2-snapshot-a2bb2ca-20240811003152",
|
|
114
|
+
"@rolldown/binding-linux-x64-gnu": "0.12.2-snapshot-a2bb2ca-20240811003152",
|
|
115
|
+
"@rolldown/binding-wasm32-wasi": "0.12.2-snapshot-a2bb2ca-20240811003152",
|
|
116
|
+
"@rolldown/binding-linux-x64-musl": "0.12.2-snapshot-a2bb2ca-20240811003152",
|
|
117
|
+
"@rolldown/binding-win32-arm64-msvc": "0.12.2-snapshot-a2bb2ca-20240811003152",
|
|
118
|
+
"@rolldown/binding-win32-ia32-msvc": "0.12.2-snapshot-a2bb2ca-20240811003152",
|
|
119
|
+
"@rolldown/binding-win32-x64-msvc": "0.12.2-snapshot-a2bb2ca-20240811003152"
|
|
120
120
|
},
|
|
121
121
|
"scripts": {
|
|
122
122
|
"# Scrips for binding #": "_",
|