pyret-embed 0.0.52 → 0.0.54
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.
|
@@ -150,6 +150,15 @@
|
|
|
150
150
|
// NOTE(joe): this function just allocates a closure, so it's stack-safe
|
|
151
151
|
var onCompile = gmf(cpo, "make-on-compile").app(runtime.makeFunction(saveGDriveCachedFile, "save-gdrive-cached-file"));
|
|
152
152
|
|
|
153
|
+
function maybeAppendSlash(s) {
|
|
154
|
+
if(s.endsWith("/")) { return s; }
|
|
155
|
+
return s + "/";
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function urlResolve(path, base) {
|
|
159
|
+
return new URL(path, base).href;
|
|
160
|
+
}
|
|
161
|
+
|
|
153
162
|
// NOTE(joe/ben): this function _used_ to be trivially stack safe, but files
|
|
154
163
|
// need to resolve their absolute path to calculate their URI, which
|
|
155
164
|
// requires an RPC, so this function is no-longer trivially flat
|
|
@@ -198,7 +207,7 @@
|
|
|
198
207
|
return arr[0];
|
|
199
208
|
}
|
|
200
209
|
else if (protocol === "url-file") {
|
|
201
|
-
return arr[
|
|
210
|
+
return urlResolve(arr[1], maybeAppendSlash(arr[0]));
|
|
202
211
|
}
|
|
203
212
|
else {
|
|
204
213
|
console.error("Unknown import: ", dependency);
|
|
@@ -256,7 +265,7 @@
|
|
|
256
265
|
return runtime.getField(runtime.getField(urlLoc, "values"), "url-locator").app(arr[0], replGlobals);
|
|
257
266
|
}
|
|
258
267
|
else if (protocol === "url-file") {
|
|
259
|
-
const fullUrl = arr[
|
|
268
|
+
const fullUrl = urlResolve(arr[1], maybeAppendSlash(arr[0]));
|
|
260
269
|
switch(urlFileMode) {
|
|
261
270
|
case "all-remote":
|
|
262
271
|
fetch(fullUrl).then(async (response) => {
|