diff options
author | 2023-04-25 07:27:18 -0700 | |
---|---|---|
committer | 2023-04-25 07:27:18 -0700 | |
commit | 126885e1fe509b69be947d79aacb3ed6efdf666a (patch) | |
tree | bef407938525d69132824ffd3b0b54796035009d /src/bun.js/builtins/cpp | |
parent | 5353d4101493632cb25d0cdddfef94f62bc5902d (diff) | |
download | bun-126885e1fe509b69be947d79aacb3ed6efdf666a.tar.gz bun-126885e1fe509b69be947d79aacb3ed6efdf666a.tar.zst bun-126885e1fe509b69be947d79aacb3ed6efdf666a.zip |
Implement `onResolve` plugins in `Bun.build()`, support multiple onLoad and onResolve plugins (#2739)
* its 2023
* WIP `onResolve` plugins
* more progress
* it compiles
* Lots of small fixes
* Seems to work excluding entry points
* Update BundlerPluginBuiltins.cpp
---------
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/bun.js/builtins/cpp')
48 files changed, 662 insertions, 46 deletions
diff --git a/src/bun.js/builtins/cpp/BundlerPluginBuiltins.cpp b/src/bun.js/builtins/cpp/BundlerPluginBuiltins.cpp new file mode 100644 index 000000000..53c357257 --- /dev/null +++ b/src/bun.js/builtins/cpp/BundlerPluginBuiltins.cpp @@ -0,0 +1,466 @@ +/* + * Copyright (c) 2015 Igalia + * Copyright (c) 2015 Igalia S.L. + * Copyright (c) 2015 Igalia. + * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. + * Copyright (c) 2015, 2016, 2017 Canon Inc. + * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#include "config.h" +#include "BundlerPluginBuiltins.h" + +#include "WebCoreJSClientData.h" +#include <JavaScriptCore/IdentifierInlines.h> +#include <JavaScriptCore/ImplementationVisibility.h> +#include <JavaScriptCore/Intrinsic.h> +#include <JavaScriptCore/JSObjectInlines.h> +#include <JavaScriptCore/VM.h> + +namespace WebCore { + +const JSC::ConstructAbility s_bundlerPluginRunOnResolvePluginsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const JSC::ConstructorKind s_bundlerPluginRunOnResolvePluginsCodeConstructorKind = JSC::ConstructorKind::None; +const JSC::ImplementationVisibility s_bundlerPluginRunOnResolvePluginsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; +const int s_bundlerPluginRunOnResolvePluginsCodeLength = 3284; +static const JSC::Intrinsic s_bundlerPluginRunOnResolvePluginsCodeIntrinsic = JSC::NoIntrinsic; +const char* const s_bundlerPluginRunOnResolvePluginsCode = + "(function (\n" \ + " specifier,\n" \ + " inputNamespace,\n" \ + " importer,\n" \ + " internalID,\n" \ + " kindId\n" \ + ") {\n" \ + " \"use strict\";\n" \ + "\n" \ + " //\n" \ + " const kind = [\n" \ + " \"entry-point\",\n" \ + " \"import-statement\",\n" \ + " \"require-call\",\n" \ + " \"dynamic-import\",\n" \ + " \"require-resolve\",\n" \ + " \"import-rule\",\n" \ + " \"url-token\",\n" \ + " \"internal\",\n" \ + " ][kindId];\n" \ + "\n" \ + " var promiseResult = (async (inputPath, inputNamespace, importer, kind) => {\n" \ + " var results = this.onResolve.@get(inputNamespace);\n" \ + " if (!resuls) {\n" \ + " this.onResolveAsync(internalID, null, null, null);\n" \ + " return null;\n" \ + " }\n" \ + "\n" \ + " for (let [filter, callback] of results) {\n" \ + " if (filtertest(inputPath)) {\n" \ + " var result = callback({\n" \ + " path: inputPath,\n" \ + " importer,\n" \ + " namespace: inputNamespace,\n" \ + " kind,\n" \ + " });\n" \ + " while (\n" \ + " result &&\n" \ + " @isPromise(result) &&\n" \ + " (@getPromiseInternalField(result, @promiseFieldFlags) &\n" \ + " @promiseStateMask) ===\n" \ + " @promiseStateFulfilled\n" \ + " ) {\n" \ + " result = @getPromiseInternalField(\n" \ + " result,\n" \ + " @promiseFieldReactionsOrResult\n" \ + " );\n" \ + " }\n" \ + "\n" \ + " if (result && @isPromise(result)) {\n" \ + " result = await result;\n" \ + " }\n" \ + "\n" \ + " if (!result || !@isObject(result)) {\n" \ + " continue;\n" \ + " }\n" \ + "\n" \ + " var {\n" \ + " path,\n" \ + " namespace: userNamespace = inputNamespace,\n" \ + " external,\n" \ + " } = result;\n" \ + " if (\n" \ + " !(typeof path === \"string\") ||\n" \ + " !(typeof userNamespace === \"string\")\n" \ + " ) {\n" \ + " @throwTypeError(\n" \ + " \"onResolve plugins must return an object with a string 'path' and string 'loader' field\"\n" \ + " );\n" \ + " }\n" \ + "\n" \ + " if (!path) {\n" \ + " continue;\n" \ + " }\n" \ + "\n" \ + " if (!userNamespace) {\n" \ + " userNamespace = inputNamespace;\n" \ + " }\n" \ + "\n" \ + " if (typeof external !== \"boolean\" && !@isUndefinedOrNull(external)) {\n" \ + " @throwTypeError(\n" \ + " 'onResolve plugins \"external\" field must be boolean or unspecified'\n" \ + " );\n" \ + " }\n" \ + "\n" \ + " if (!external) {\n" \ + " if (userNamespace === \"file\") {\n" \ + " //\n" \ + " if (path[0] !== \"/\" || path.includes(\"..\")) {\n" \ + " @throwTypeError(\n" \ + " 'onResolve plugin \"path\" must be absolute when the namespace is \"file\"'\n" \ + " );\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " if (userNamespace === \"dataurl\") {\n" \ + " if (!path.startsWith(\"data:\")) {\n" \ + " @throwTypeError(\n" \ + " 'onResolve plugin \"path\" must start with \"data:\" when the namespace is\"dataurl\"'\n" \ + " );\n" \ + " }\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " this.onReslveAsync(internalID, path, userNamespace, external);\n" \ + " return null;\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " this.onResolveAsync(internalID, null, null, null);\n" \ + " return null;\n" \ + " })(specifier, inputNamespace, importer, kind);\n" \ + "\n" \ + " while (\n" \ + " promiseResult &&\n" \ + " @isPromise(promiseResult) &&\n" \ + " (@getPromiseInternalField(promiseResult, @promiseFieldFlags) &\n" \ + " @promiseStateMask) ===\n" \ + " @promiseStateFulfilled\n" \ + " ) {\n" \ + " promiseResult = @getPromiseInternalField(\n" \ + " promiseResult,\n" \ + " @promiseFieldReactionsOrResult\n" \ + " );\n" \ + " }\n" \ + "\n" \ + " if (promiseResult && @isPromise(promiseResult)) {\n" \ + " promiseResult.then(\n" \ + " () => {},\n" \ + " (e) => {\n" \ + " this.addError(internalID, e, 0);\n" \ + " }\n" \ + " );\n" \ + " }\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_bundlerPluginRunSetupFunctionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const JSC::ConstructorKind s_bundlerPluginRunSetupFunctionCodeConstructorKind = JSC::ConstructorKind::None; +const JSC::ImplementationVisibility s_bundlerPluginRunSetupFunctionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; +const int s_bundlerPluginRunSetupFunctionCodeLength = 3262; +static const JSC::Intrinsic s_bundlerPluginRunSetupFunctionCodeIntrinsic = JSC::NoIntrinsic; +const char* const s_bundlerPluginRunSetupFunctionCode = + "(function (setup) {\n" \ + " \"use strict\";\n" \ + " var onLoadPlugins = new Map(),\n" \ + " onResolvePlugins = new Map();\n" \ + "\n" \ + " function validate(filterObject, callback, map) {\n" \ + " if (!filterObject || !@isObject(filterObject)) {\n" \ + " @throwTypeError('Expected an object with \"filter\" RegExp');\n" \ + " }\n" \ + "\n" \ + " if (!callback || !@isCallable(callback)) {\n" \ + " @throwTypeError(\"callback must be a function\");\n" \ + " }\n" \ + "\n" \ + " var { filter, namespace = \"file\" } = filterObject;\n" \ + "\n" \ + " if (!filter) {\n" \ + " @throwTypeError('Expected an object with \"filter\" RegExp');\n" \ + " }\n" \ + "\n" \ + " if (!@isRegExpObject(filter)) {\n" \ + " @throwTypeError(\"filter must be a RegExp\");\n" \ + " }\n" \ + "\n" \ + " if (namespace && !(typeof namespace === \"string\")) {\n" \ + " @throwTypeError(\"namespace must be a string\");\n" \ + " }\n" \ + "\n" \ + " if (namespace?.length ?? 0) {\n" \ + " namespace = \"file\";\n" \ + " }\n" \ + "\n" \ + " if (!/^([/@a-zA-Z0-9_\\\\-]+)$/.test(namespace)) {\n" \ + " @throwTypeError(\"namespace can only contain @a-zA-Z0-9_\\\\-\");\n" \ + " }\n" \ + "\n" \ + " var callbacks = map.@get(namespace);\n" \ + "\n" \ + " if (!callbacks) {\n" \ + " map.@set(namespace, [[filter, callback]]);\n" \ + " } else {\n" \ + " @arrayPush(callbacks, [filter, callback]);\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " function onLoad(filterObject, callback) {\n" \ + " validate(filterObject, callback, onLoadPlugins);\n" \ + " }\n" \ + "\n" \ + " function onResolve(filterObject, callback) {\n" \ + " validate(filterObject, callback, onResolvePlugins);\n" \ + " }\n" \ + "\n" \ + " const processSetupResult = () => {\n" \ + " var anyOnLoad = false,\n" \ + " anyOnResolve = false;\n" \ + "\n" \ + " for (var [namespace, callbacks] of onLoadPlugins.entries()) {\n" \ + " for (var [filter] of callbacks) {\n" \ + " this.addFilter(filter, namespace, 1);\n" \ + " anyOnLoad = true;\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " for (var [namespace, callbacks] of onResolvePlugins.entries()) {\n" \ + " for (var [filter] of callbacks) {\n" \ + " this.addFilter(filter, namespace, 0);\n" \ + " anyOnResolve = true;\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " if (anyOnResolve) {\n" \ + " var onResolveObject = this.onResolve;\n" \ + " if (!onResolveObject) {\n" \ + " this.onResolve = onResolvePlugins;\n" \ + " } else {\n" \ + " for (var [namespace, callbacks] of onResolvePlugins.entries()) {\n" \ + " var existing = onResolveObject.@get(namespace);\n" \ + "\n" \ + " if (!existing) {\n" \ + " onResolveObject.@set(namespace, callbacks);\n" \ + " } else {\n" \ + " onResolveObject.@set(existing.concat(callbacks));\n" \ + " }\n" \ + " }\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " if (anyOnLoad) {\n" \ + " var onLoadObject = this.onLoad;\n" \ + " if (!onLoadObject) {\n" \ + " this.onLoad = onLoadPlugins;\n" \ + " } else {\n" \ + " for (var [namespace, callbacks] of onLoadPlugins.entries()) {\n" \ + " var existing = onLoadObject.@get(namespace);\n" \ + "\n" \ + " if (!existing) {\n" \ + " onLoadObject.@set(namespace, callbacks);\n" \ + " } else {\n" \ + " onLoadObject.@set(existing.concat(callbacks));\n" \ + " }\n" \ + " }\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " return anyOnLoad || anyOnResolve;\n" \ + " };\n" \ + "\n" \ + " var setupResult = setup({\n" \ + " onLoad,\n" \ + " onResolve,\n" \ + " });\n" \ + "\n" \ + " if (setupResult && @isPromise(setupResult)) {\n" \ + " if (\n" \ + " @getPromiseInternalField(setupResult, @promiseFieldFlags) &\n" \ + " @promiseStateFulfilled\n" \ + " ) {\n" \ + " setupResult = @getPromiseInternalField(\n" \ + " setupResult,\n" \ + " @promiseFieldReactionsOrResult\n" \ + " );\n" \ + " } else {\n" \ + " return setupResult.@then(processSetupResult);\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " return processSetupResult();\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_bundlerPluginRunOnLoadPluginsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const JSC::ConstructorKind s_bundlerPluginRunOnLoadPluginsCodeConstructorKind = JSC::ConstructorKind::None; +const JSC::ImplementationVisibility s_bundlerPluginRunOnLoadPluginsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; +const int s_bundlerPluginRunOnLoadPluginsCodeLength = 2726; +static const JSC::Intrinsic s_bundlerPluginRunOnLoadPluginsCodeIntrinsic = JSC::NoIntrinsic; +const char* const s_bundlerPluginRunOnLoadPluginsCode = + "(function (internalID, path, namespace, defaultLoaderId) {\n" \ + " \"use strict\";\n" \ + "\n" \ + " const LOADERS_MAP = {\n" \ + " jsx: 0,\n" \ + " js: 1,\n" \ + " ts: 2,\n" \ + " tsx: 3,\n" \ + " css: 4,\n" \ + " file: 5,\n" \ + " json: 6,\n" \ + " toml: 7,\n" \ + " wasm: 8,\n" \ + " napi: 9,\n" \ + " base64: 10,\n" \ + " dataurl: 11,\n" \ + " text: 12,\n" \ + " };\n" \ + " const loaderName = [\n" \ + " \"jsx\",\n" \ + " \"js\",\n" \ + " \"ts\",\n" \ + " \"tsx\",\n" \ + " \"css\",\n" \ + " \"file\",\n" \ + " \"json\",\n" \ + " \"toml\",\n" \ + " \"wasm\",\n" \ + " \"napi\",\n" \ + " \"base64\",\n" \ + " \"dataurl\",\n" \ + " \"text\",\n" \ + " ][defaultLoaderId];\n" \ + "\n" \ + " var promiseResult = (async (internalID, path, namespace, defaultLoader) => {\n" \ + " var results = this.onLoad.@get(namespace);\n" \ + " if (!results) {\n" \ + " this.onLoadAsync(internalID, null, null, null);\n" \ + " return null;\n" \ + " }\n" \ + "\n" \ + " for (let [filter, callback] of results) {\n" \ + " if (filter.test(path)) {\n" \ + " var result = callback({\n" \ + " path,\n" \ + " namespace,\n" \ + " loader: defaultLoader,\n" \ + " });\n" \ + "\n" \ + " while (\n" \ + " result &&\n" \ + " @isPromise(result) &&\n" \ + " (@getPromiseInternalField(result, @promiseFieldFlags) &\n" \ + " @promiseStateMask) ===\n" \ + " @promiseStateFulfilled\n" \ + " ) {\n" \ + " result = @getPromiseInternalField(\n" \ + " result,\n" \ + " @promiseFieldReactionsOrResult\n" \ + " );\n" \ + " }\n" \ + "\n" \ + " if (result && @isPromise(result)) {\n" \ + " result = await result;\n" \ + " }\n" \ + "\n" \ + " if (!result || !@isObject(result)) {\n" \ + " continue;\n" \ + " }\n" \ + "\n" \ + " var { contents, loader = defaultLoader } = result;\n" \ + " if (!(typeof contents === \"string\") && !@isTypedArrayView(contents)) {\n" \ + " @throwTypeError(\n" \ + " 'onLoad plugins must return an object with \"contents\" as a string or Uint8Array'\n" \ + " );\n" \ + " }\n" \ + "\n" \ + " if (!(typeof loader === \"string\")) {\n" \ + " @throwTypeError(\n" \ + " 'onLoad plugins must return an object with \"loader\" as a string'\n" \ + " );\n" \ + " }\n" \ + "\n" \ + " const chosenLoader = LOADERS_MAP[loader];\n" \ + " if (chosenLoader === @undefined) {\n" \ + " @throwTypeError('Loader \"' + loader + '\" is not supported.');\n" \ + " }\n" \ + "\n" \ + " this.onLoadAsync(internalID, contents, chosenLoader);\n" \ + " return null;\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " this.onLoadAsync(internalID, null, null);\n" \ + " return null;\n" \ + " })(internalID, path, namespace, loaderName);\n" \ + "\n" \ + " while (\n" \ + " promiseResult &&\n" \ + " @isPromise(promiseResult) &&\n" \ + " (@getPromiseInternalField(promiseResult, @promiseFieldFlags) &\n" \ + " @promiseStateMask) ===\n" \ + " @promiseStateFulfilled\n" \ + " ) {\n" \ + " promiseResult = @getPromiseInternalField(\n" \ + " promiseResult,\n" \ + " @promiseFieldReactionsOrResult\n" \ + " );\n" \ + " }\n" \ + "\n" \ + " if (promiseResult && @isPromise(promiseResult)) {\n" \ + " promiseResult.then(\n" \ + " () => {},\n" \ + " (e) => {\n" \ + " this.addError(internalID, e, 0);\n" \ + " }\n" \ + " );\n" \ + " }\n" \ + "})\n" \ +; + + +#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ +JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ +{\ + JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ + return clientData->builtinFunctions().bundlerPluginBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().bundlerPluginBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ +} +WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) +#undef DEFINE_BUILTIN_GENERATOR + + +} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/BundlerPluginBuiltins.h b/src/bun.js/builtins/cpp/BundlerPluginBuiltins.h new file mode 100644 index 000000000..91b3233f2 --- /dev/null +++ b/src/bun.js/builtins/cpp/BundlerPluginBuiltins.h @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2015 Igalia + * Copyright (c) 2015 Igalia S.L. + * Copyright (c) 2015 Igalia. + * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. + * Copyright (c) 2015, 2016, 2017 Canon Inc. + * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#pragma once + +#include <JavaScriptCore/BuiltinUtils.h> +#include <JavaScriptCore/Identifier.h> +#include <JavaScriptCore/JSFunction.h> +#include <JavaScriptCore/UnlinkedFunctionExecutable.h> + +namespace JSC { +class FunctionExecutable; +} + +namespace WebCore { + +/* BundlerPlugin */ +extern const char* const s_bundlerPluginRunOnResolvePluginsCode; +extern const int s_bundlerPluginRunOnResolvePluginsCodeLength; +extern const JSC::ConstructAbility s_bundlerPluginRunOnResolvePluginsCodeConstructAbility; +extern const JSC::ConstructorKind s_bundlerPluginRunOnResolvePluginsCodeConstructorKind; +extern const JSC::ImplementationVisibility s_bundlerPluginRunOnResolvePluginsCodeImplementationVisibility; +extern const char* const s_bundlerPluginRunSetupFunctionCode; +extern const int s_bundlerPluginRunSetupFunctionCodeLength; +extern const JSC::ConstructAbility s_bundlerPluginRunSetupFunctionCodeConstructAbility; +extern const JSC::ConstructorKind s_bundlerPluginRunSetupFunctionCodeConstructorKind; +extern const JSC::ImplementationVisibility s_bundlerPluginRunSetupFunctionCodeImplementationVisibility; +extern const char* const s_bundlerPluginRunOnLoadPluginsCode; +extern const int s_bundlerPluginRunOnLoadPluginsCodeLength; +extern const JSC::ConstructAbility s_bundlerPluginRunOnLoadPluginsCodeConstructAbility; +extern const JSC::ConstructorKind s_bundlerPluginRunOnLoadPluginsCodeConstructorKind; +extern const JSC::ImplementationVisibility s_bundlerPluginRunOnLoadPluginsCodeImplementationVisibility; + +#define WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_DATA(macro) \ + macro(runOnResolvePlugins, bundlerPluginRunOnResolvePlugins, 5) \ + macro(runSetupFunction, bundlerPluginRunSetupFunction, 1) \ + macro(runOnLoadPlugins, bundlerPluginRunOnLoadPlugins, 4) \ + +#define WEBCORE_BUILTIN_BUNDLERPLUGIN_RUNONRESOLVEPLUGINS 1 +#define WEBCORE_BUILTIN_BUNDLERPLUGIN_RUNSETUPFUNCTION 1 +#define WEBCORE_BUILTIN_BUNDLERPLUGIN_RUNONLOADPLUGINS 1 + +#define WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(macro) \ + macro(bundlerPluginRunOnResolvePluginsCode, runOnResolvePlugins, ASCIILiteral(), s_bundlerPluginRunOnResolvePluginsCodeLength) \ + macro(bundlerPluginRunSetupFunctionCode, runSetupFunction, ASCIILiteral(), s_bundlerPluginRunSetupFunctionCodeLength) \ + macro(bundlerPluginRunOnLoadPluginsCode, runOnLoadPlugins, ASCIILiteral(), s_bundlerPluginRunOnLoadPluginsCodeLength) \ + +#define WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_FUNCTION_NAME(macro) \ + macro(runOnLoadPlugins) \ + macro(runOnResolvePlugins) \ + macro(runSetupFunction) \ + +#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ + JSC::FunctionExecutable* codeName##Generator(JSC::VM&); + +WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) +#undef DECLARE_BUILTIN_GENERATOR + +class BundlerPluginBuiltinsWrapper : private JSC::WeakHandleOwner { +public: + explicit BundlerPluginBuiltinsWrapper(JSC::VM& vm) + : m_vm(vm) + WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) +#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) + WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) +#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS + { + } + +#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ + JSC::UnlinkedFunctionExecutable* name##Executable(); \ + const JSC::SourceCode& name##Source() const { return m_##name##Source; } + WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) +#undef EXPOSE_BUILTIN_EXECUTABLES + + WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) + + void exportNames(); + +private: + JSC::VM& m_vm; + + WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) + +#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ + JSC::SourceCode m_##name##Source;\ + JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; + WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) +#undef DECLARE_BUILTIN_SOURCE_MEMBERS + +}; + +#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ +inline JSC::UnlinkedFunctionExecutable* BundlerPluginBuiltinsWrapper::name##Executable() \ +{\ + if (!m_##name##Executable) {\ + JSC::Identifier executableName = functionName##PublicName();\ + if (overriddenName)\ + executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ + m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ + }\ + return m_##name##Executable.get();\ +} +WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) +#undef DEFINE_BUILTIN_EXECUTABLES + +inline void BundlerPluginBuiltinsWrapper::exportNames() +{ +#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); + WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) +#undef EXPORT_FUNCTION_NAME +} + +} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ByteLengthQueuingStrategyBuiltins.cpp b/src/bun.js/builtins/cpp/ByteLengthQueuingStrategyBuiltins.cpp index bea8d88c3..3f5c2e8d7 100644 --- a/src/bun.js/builtins/cpp/ByteLengthQueuingStrategyBuiltins.cpp +++ b/src/bun.js/builtins/cpp/ByteLengthQueuingStrategyBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ByteLengthQueuingStrategyBuiltins.h b/src/bun.js/builtins/cpp/ByteLengthQueuingStrategyBuiltins.h index fc56f2911..29c6f2830 100644 --- a/src/bun.js/builtins/cpp/ByteLengthQueuingStrategyBuiltins.h +++ b/src/bun.js/builtins/cpp/ByteLengthQueuingStrategyBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ConsoleObjectBuiltins.cpp b/src/bun.js/builtins/cpp/ConsoleObjectBuiltins.cpp index 3c00ec702..438c84b67 100644 --- a/src/bun.js/builtins/cpp/ConsoleObjectBuiltins.cpp +++ b/src/bun.js/builtins/cpp/ConsoleObjectBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ConsoleObjectBuiltins.h b/src/bun.js/builtins/cpp/ConsoleObjectBuiltins.h index 975394c5f..128468602 100644 --- a/src/bun.js/builtins/cpp/ConsoleObjectBuiltins.h +++ b/src/bun.js/builtins/cpp/ConsoleObjectBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/CountQueuingStrategyBuiltins.cpp b/src/bun.js/builtins/cpp/CountQueuingStrategyBuiltins.cpp index 10ec153ba..7690a83de 100644 --- a/src/bun.js/builtins/cpp/CountQueuingStrategyBuiltins.cpp +++ b/src/bun.js/builtins/cpp/CountQueuingStrategyBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/CountQueuingStrategyBuiltins.h b/src/bun.js/builtins/cpp/CountQueuingStrategyBuiltins.h index 06811f00a..b03125a76 100644 --- a/src/bun.js/builtins/cpp/CountQueuingStrategyBuiltins.h +++ b/src/bun.js/builtins/cpp/CountQueuingStrategyBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ImportMetaObjectBuiltins.cpp b/src/bun.js/builtins/cpp/ImportMetaObjectBuiltins.cpp index ca1efe026..83a2ba8c2 100644 --- a/src/bun.js/builtins/cpp/ImportMetaObjectBuiltins.cpp +++ b/src/bun.js/builtins/cpp/ImportMetaObjectBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ImportMetaObjectBuiltins.h b/src/bun.js/builtins/cpp/ImportMetaObjectBuiltins.h index 1a7c5d844..b5a4f6e6b 100644 --- a/src/bun.js/builtins/cpp/ImportMetaObjectBuiltins.h +++ b/src/bun.js/builtins/cpp/ImportMetaObjectBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/JSBufferConstructorBuiltins.cpp b/src/bun.js/builtins/cpp/JSBufferConstructorBuiltins.cpp index 11b3325dc..6e663afce 100644 --- a/src/bun.js/builtins/cpp/JSBufferConstructorBuiltins.cpp +++ b/src/bun.js/builtins/cpp/JSBufferConstructorBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/JSBufferConstructorBuiltins.h b/src/bun.js/builtins/cpp/JSBufferConstructorBuiltins.h index f9181b402..da990268b 100644 --- a/src/bun.js/builtins/cpp/JSBufferConstructorBuiltins.h +++ b/src/bun.js/builtins/cpp/JSBufferConstructorBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.cpp b/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.cpp index 0b13457e4..8bd695758 100644 --- a/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.cpp +++ b/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.h b/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.h index 60c00bedf..38544b9b5 100644 --- a/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.h +++ b/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.cpp b/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.cpp index 63882fd9a..ecd86f811 100644 --- a/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.cpp +++ b/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.h b/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.h index a109d2de0..4fcdb4810 100644 --- a/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.h +++ b/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ReadableByteStreamControllerBuiltins.cpp b/src/bun.js/builtins/cpp/ReadableByteStreamControllerBuiltins.cpp index b55d1782a..9f431a8d0 100644 --- a/src/bun.js/builtins/cpp/ReadableByteStreamControllerBuiltins.cpp +++ b/src/bun.js/builtins/cpp/ReadableByteStreamControllerBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ReadableByteStreamControllerBuiltins.h b/src/bun.js/builtins/cpp/ReadableByteStreamControllerBuiltins.h index 2e19b9d21..20083abbb 100644 --- a/src/bun.js/builtins/cpp/ReadableByteStreamControllerBuiltins.h +++ b/src/bun.js/builtins/cpp/ReadableByteStreamControllerBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ReadableByteStreamInternalsBuiltins.cpp b/src/bun.js/builtins/cpp/ReadableByteStreamInternalsBuiltins.cpp index 9b5d31790..5d7e20a5c 100644 --- a/src/bun.js/builtins/cpp/ReadableByteStreamInternalsBuiltins.cpp +++ b/src/bun.js/builtins/cpp/ReadableByteStreamInternalsBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ReadableByteStreamInternalsBuiltins.h b/src/bun.js/builtins/cpp/ReadableByteStreamInternalsBuiltins.h index 06ee280bf..aa140d53e 100644 --- a/src/bun.js/builtins/cpp/ReadableByteStreamInternalsBuiltins.h +++ b/src/bun.js/builtins/cpp/ReadableByteStreamInternalsBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ReadableStreamBYOBReaderBuiltins.cpp b/src/bun.js/builtins/cpp/ReadableStreamBYOBReaderBuiltins.cpp index 28893061f..04264fc40 100644 --- a/src/bun.js/builtins/cpp/ReadableStreamBYOBReaderBuiltins.cpp +++ b/src/bun.js/builtins/cpp/ReadableStreamBYOBReaderBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ReadableStreamBYOBReaderBuiltins.h b/src/bun.js/builtins/cpp/ReadableStreamBYOBReaderBuiltins.h index c1d1a4c7f..54f1985c7 100644 --- a/src/bun.js/builtins/cpp/ReadableStreamBYOBReaderBuiltins.h +++ b/src/bun.js/builtins/cpp/ReadableStreamBYOBReaderBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ReadableStreamBYOBRequestBuiltins.cpp b/src/bun.js/builtins/cpp/ReadableStreamBYOBRequestBuiltins.cpp index 30ff7eea1..7c67a3443 100644 --- a/src/bun.js/builtins/cpp/ReadableStreamBYOBRequestBuiltins.cpp +++ b/src/bun.js/builtins/cpp/ReadableStreamBYOBRequestBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ReadableStreamBYOBRequestBuiltins.h b/src/bun.js/builtins/cpp/ReadableStreamBYOBRequestBuiltins.h index a5549ad98..497a17bb0 100644 --- a/src/bun.js/builtins/cpp/ReadableStreamBYOBRequestBuiltins.h +++ b/src/bun.js/builtins/cpp/ReadableStreamBYOBRequestBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ReadableStreamBuiltins.cpp b/src/bun.js/builtins/cpp/ReadableStreamBuiltins.cpp index c8d329052..21c099c56 100644 --- a/src/bun.js/builtins/cpp/ReadableStreamBuiltins.cpp +++ b/src/bun.js/builtins/cpp/ReadableStreamBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ReadableStreamBuiltins.h b/src/bun.js/builtins/cpp/ReadableStreamBuiltins.h index b85038a43..47ebda954 100644 --- a/src/bun.js/builtins/cpp/ReadableStreamBuiltins.h +++ b/src/bun.js/builtins/cpp/ReadableStreamBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ReadableStreamDefaultControllerBuiltins.cpp b/src/bun.js/builtins/cpp/ReadableStreamDefaultControllerBuiltins.cpp index 27fcaba83..8719e4cc1 100644 --- a/src/bun.js/builtins/cpp/ReadableStreamDefaultControllerBuiltins.cpp +++ b/src/bun.js/builtins/cpp/ReadableStreamDefaultControllerBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ReadableStreamDefaultControllerBuiltins.h b/src/bun.js/builtins/cpp/ReadableStreamDefaultControllerBuiltins.h index 5ae59810a..3925f5fb9 100644 --- a/src/bun.js/builtins/cpp/ReadableStreamDefaultControllerBuiltins.h +++ b/src/bun.js/builtins/cpp/ReadableStreamDefaultControllerBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ReadableStreamDefaultReaderBuiltins.cpp b/src/bun.js/builtins/cpp/ReadableStreamDefaultReaderBuiltins.cpp index b8f617978..2e8388a4f 100644 --- a/src/bun.js/builtins/cpp/ReadableStreamDefaultReaderBuiltins.cpp +++ b/src/bun.js/builtins/cpp/ReadableStreamDefaultReaderBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ReadableStreamDefaultReaderBuiltins.h b/src/bun.js/builtins/cpp/ReadableStreamDefaultReaderBuiltins.h index b883be6b8..cd061220a 100644 --- a/src/bun.js/builtins/cpp/ReadableStreamDefaultReaderBuiltins.h +++ b/src/bun.js/builtins/cpp/ReadableStreamDefaultReaderBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.cpp b/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.cpp index 40f421b56..b7d388218 100644 --- a/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.cpp +++ b/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.h b/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.h index a617260be..d34758e0b 100644 --- a/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.h +++ b/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/StreamInternalsBuiltins.cpp b/src/bun.js/builtins/cpp/StreamInternalsBuiltins.cpp index 7663e93ef..7f84dd40e 100644 --- a/src/bun.js/builtins/cpp/StreamInternalsBuiltins.cpp +++ b/src/bun.js/builtins/cpp/StreamInternalsBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/StreamInternalsBuiltins.h b/src/bun.js/builtins/cpp/StreamInternalsBuiltins.h index 089992d77..b068e244c 100644 --- a/src/bun.js/builtins/cpp/StreamInternalsBuiltins.h +++ b/src/bun.js/builtins/cpp/StreamInternalsBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/TransformStreamBuiltins.cpp b/src/bun.js/builtins/cpp/TransformStreamBuiltins.cpp index ee31dd1aa..7552cc5b0 100644 --- a/src/bun.js/builtins/cpp/TransformStreamBuiltins.cpp +++ b/src/bun.js/builtins/cpp/TransformStreamBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/TransformStreamBuiltins.h b/src/bun.js/builtins/cpp/TransformStreamBuiltins.h index 8547fd350..68b36206a 100644 --- a/src/bun.js/builtins/cpp/TransformStreamBuiltins.h +++ b/src/bun.js/builtins/cpp/TransformStreamBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/TransformStreamDefaultControllerBuiltins.cpp b/src/bun.js/builtins/cpp/TransformStreamDefaultControllerBuiltins.cpp index 3584e70ef..696d11c80 100644 --- a/src/bun.js/builtins/cpp/TransformStreamDefaultControllerBuiltins.cpp +++ b/src/bun.js/builtins/cpp/TransformStreamDefaultControllerBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/TransformStreamDefaultControllerBuiltins.h b/src/bun.js/builtins/cpp/TransformStreamDefaultControllerBuiltins.h index a38e0111e..b0b75cda8 100644 --- a/src/bun.js/builtins/cpp/TransformStreamDefaultControllerBuiltins.h +++ b/src/bun.js/builtins/cpp/TransformStreamDefaultControllerBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/TransformStreamInternalsBuiltins.cpp b/src/bun.js/builtins/cpp/TransformStreamInternalsBuiltins.cpp index 7a89bff99..329eb52ea 100644 --- a/src/bun.js/builtins/cpp/TransformStreamInternalsBuiltins.cpp +++ b/src/bun.js/builtins/cpp/TransformStreamInternalsBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/TransformStreamInternalsBuiltins.h b/src/bun.js/builtins/cpp/TransformStreamInternalsBuiltins.h index 4850ac1fb..b362896c9 100644 --- a/src/bun.js/builtins/cpp/TransformStreamInternalsBuiltins.h +++ b/src/bun.js/builtins/cpp/TransformStreamInternalsBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/WebCoreJSBuiltinInternals.h b/src/bun.js/builtins/cpp/WebCoreJSBuiltinInternals.h index fe709cb07..fde4bb97e 100644 --- a/src/bun.js/builtins/cpp/WebCoreJSBuiltinInternals.h +++ b/src/bun.js/builtins/cpp/WebCoreJSBuiltinInternals.h @@ -9,7 +9,7 @@ namespace Zig { class GlobalObject; } * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/WebCoreJSBuiltins.h b/src/bun.js/builtins/cpp/WebCoreJSBuiltins.h index 598e0948e..63a375248 100644 --- a/src/bun.js/builtins/cpp/WebCoreJSBuiltins.h +++ b/src/bun.js/builtins/cpp/WebCoreJSBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,6 +35,7 @@ #pragma once +#include "BundlerPluginBuiltins.h" #include "ByteLengthQueuingStrategyBuiltins.h" #include "ConsoleObjectBuiltins.h" #include "CountQueuingStrategyBuiltins.h" @@ -65,6 +66,7 @@ class JSBuiltinFunctions { public: explicit JSBuiltinFunctions(JSC::VM& vm) : m_vm(vm) + , m_bundlerPluginBuiltins(m_vm) , m_byteLengthQueuingStrategyBuiltins(m_vm) , m_consoleObjectBuiltins(m_vm) , m_countQueuingStrategyBuiltins(m_vm) @@ -95,6 +97,7 @@ public: m_writableStreamInternalsBuiltins.exportNames(); } + BundlerPluginBuiltinsWrapper& bundlerPluginBuiltins() { return m_bundlerPluginBuiltins; } ByteLengthQueuingStrategyBuiltinsWrapper& byteLengthQueuingStrategyBuiltins() { return m_byteLengthQueuingStrategyBuiltins; } ConsoleObjectBuiltinsWrapper& consoleObjectBuiltins() { return m_consoleObjectBuiltins; } CountQueuingStrategyBuiltinsWrapper& countQueuingStrategyBuiltins() { return m_countQueuingStrategyBuiltins; } @@ -120,6 +123,7 @@ public: private: JSC::VM& m_vm; + BundlerPluginBuiltinsWrapper m_bundlerPluginBuiltins; ByteLengthQueuingStrategyBuiltinsWrapper m_byteLengthQueuingStrategyBuiltins; ConsoleObjectBuiltinsWrapper m_consoleObjectBuiltins; CountQueuingStrategyBuiltinsWrapper m_countQueuingStrategyBuiltins; diff --git a/src/bun.js/builtins/cpp/WritableStreamDefaultControllerBuiltins.cpp b/src/bun.js/builtins/cpp/WritableStreamDefaultControllerBuiltins.cpp index 90d672297..9da322b83 100644 --- a/src/bun.js/builtins/cpp/WritableStreamDefaultControllerBuiltins.cpp +++ b/src/bun.js/builtins/cpp/WritableStreamDefaultControllerBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/WritableStreamDefaultControllerBuiltins.h b/src/bun.js/builtins/cpp/WritableStreamDefaultControllerBuiltins.h index 41e5a62ab..ca7d33d66 100644 --- a/src/bun.js/builtins/cpp/WritableStreamDefaultControllerBuiltins.h +++ b/src/bun.js/builtins/cpp/WritableStreamDefaultControllerBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/WritableStreamDefaultWriterBuiltins.cpp b/src/bun.js/builtins/cpp/WritableStreamDefaultWriterBuiltins.cpp index 580e85d6f..fc00693ca 100644 --- a/src/bun.js/builtins/cpp/WritableStreamDefaultWriterBuiltins.cpp +++ b/src/bun.js/builtins/cpp/WritableStreamDefaultWriterBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/WritableStreamDefaultWriterBuiltins.h b/src/bun.js/builtins/cpp/WritableStreamDefaultWriterBuiltins.h index 70d154bcd..fe0a6ef34 100644 --- a/src/bun.js/builtins/cpp/WritableStreamDefaultWriterBuiltins.h +++ b/src/bun.js/builtins/cpp/WritableStreamDefaultWriterBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/WritableStreamInternalsBuiltins.cpp b/src/bun.js/builtins/cpp/WritableStreamInternalsBuiltins.cpp index 44c3e05a4..6b2111f4b 100644 --- a/src/bun.js/builtins/cpp/WritableStreamInternalsBuiltins.cpp +++ b/src/bun.js/builtins/cpp/WritableStreamInternalsBuiltins.cpp @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/bun.js/builtins/cpp/WritableStreamInternalsBuiltins.h b/src/bun.js/builtins/cpp/WritableStreamInternalsBuiltins.h index f38a4ac60..bc114276b 100644 --- a/src/bun.js/builtins/cpp/WritableStreamInternalsBuiltins.h +++ b/src/bun.js/builtins/cpp/WritableStreamInternalsBuiltins.h @@ -5,7 +5,7 @@ * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. * Copyright (c) 2015, 2016, 2017 Canon Inc. * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * Copyright (c) 2023 Codeblog Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions |