aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/builtins/js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-04-25 08:19:40 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-04-25 08:19:40 -0700
commit2256d43a32164433431f387ebc7c40597bb10638 (patch)
tree19e69966c73b8353df789e8886f9e18c7e9b49f3 /src/bun.js/builtins/js
parent947634c9ed2e9f33b884b96686762a1a64a6a083 (diff)
downloadbun-2256d43a32164433431f387ebc7c40597bb10638.tar.gz
bun-2256d43a32164433431f387ebc7c40597bb10638.tar.zst
bun-2256d43a32164433431f387ebc7c40597bb10638.zip
now it works
Diffstat (limited to 'src/bun.js/builtins/js')
-rw-r--r--src/bun.js/builtins/js/BundlerPlugin.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/bun.js/builtins/js/BundlerPlugin.js b/src/bun.js/builtins/js/BundlerPlugin.js
index 7f8170eb2..9fbb323ed 100644
--- a/src/bun.js/builtins/js/BundlerPlugin.js
+++ b/src/bun.js/builtins/js/BundlerPlugin.js
@@ -54,7 +54,7 @@ function runOnResolvePlugins(
var promiseResult = (async (inputPath, inputNamespace, importer, kind) => {
var results = this.onResolve.@get(inputNamespace);
- if (!resuls) {
+ if (!results) {
this.onResolveAsync(internalID, null, null, null);
return null;
}
@@ -67,6 +67,7 @@ function runOnResolvePlugins(
namespace: inputNamespace,
kind,
});
+
while (
result &&
@isPromise(result) &&
@@ -88,6 +89,7 @@ function runOnResolvePlugins(
continue;
}
+
var {
path,
namespace: userNamespace = inputNamespace,
@@ -109,7 +111,6 @@ function runOnResolvePlugins(
if (!userNamespace) {
userNamespace = inputNamespace;
}
-
if (typeof external !== "boolean" && !@isUndefinedOrNull(external)) {
@throwTypeError(
'onResolve plugins "external" field must be boolean or unspecified'
@@ -120,14 +121,13 @@ function runOnResolvePlugins(
if (!external) {
if (userNamespace === "file") {
// TODO: Windows
+
if (path[0] !== "/" || path.includes("..")) {
@throwTypeError(
'onResolve plugin "path" must be absolute when the namespace is "file"'
);
}
}
-
-
if (userNamespace === "dataurl") {
if (!path.startsWith("data:")) {
@throwTypeError(
@@ -136,8 +136,7 @@ function runOnResolvePlugins(
}
}
}
-
- this.onReslveAsync(internalID, path, userNamespace, external);
+ this.onResolveAsync(internalID, path, userNamespace, external);
return null;
}
}
@@ -413,7 +412,7 @@ function runOnLoadPlugins(internalID, path, namespace, defaultLoaderId) {
promiseResult.then(
() => {},
(e) => {
- this.addError(internalID, e, 0);
+ this.addError(internalID, e, 1);
}
);
}