From 96e113f41c0dae1ccd58c6d1e3b6dd2c54769636 Mon Sep 17 00:00:00 2001 From: dave caruso Date: Sat, 29 Apr 2023 00:08:48 -0400 Subject: bundler tests: rest of default.test.ts and starting jsx tests (#2765) --- src/bun.js/builtins/js/BundlerPlugin.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/bun.js/builtins/js/BundlerPlugin.js') diff --git a/src/bun.js/builtins/js/BundlerPlugin.js b/src/bun.js/builtins/js/BundlerPlugin.js index 9fbb323ed..4daa2dcbb 100644 --- a/src/bun.js/builtins/js/BundlerPlugin.js +++ b/src/bun.js/builtins/js/BundlerPlugin.js @@ -221,6 +221,19 @@ function runSetupFunction(setup) { validate(filterObject, callback, onResolvePlugins); } + function onStart(callback) { + // builtin generator thinks the // in the link is a comment and removes it + @throwTypeError("On-start callbacks are not implemented yet. See https:/\/github.com/oven-sh/bun/issues/2771"); + } + + function onEnd(callback) { + @throwTypeError("On-end callbacks are not implemented yet. See https:/\/github.com/oven-sh/bun/issues/2771"); + } + + function onDispose(callback) { + @throwTypeError("On-dispose callbacks are not implemented yet. See https:/\/github.com/oven-sh/bun/issues/2771"); + } + const processSetupResult = () => { var anyOnLoad = false, anyOnResolve = false; @@ -250,7 +263,7 @@ function runSetupFunction(setup) { if (!existing) { onResolveObject.@set(namespace, callbacks); } else { - onResolveObject.@set(existing.concat(callbacks)); + onResolveObject.@set(namespace, existing.concat(callbacks)); } } } @@ -267,7 +280,7 @@ function runSetupFunction(setup) { if (!existing) { onLoadObject.@set(namespace, callbacks); } else { - onLoadObject.@set(existing.concat(callbacks)); + onLoadObject.@set(namespace, existing.concat(callbacks)); } } } @@ -277,8 +290,11 @@ function runSetupFunction(setup) { }; var setupResult = setup({ + onDispose, + onEnd, onLoad, onResolve, + onStart, }); if (setupResult && @isPromise(setupResult)) { -- cgit v1.2.3