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.
@@ -314024,6 +314024,15 @@ ${labelRow}`;
314024
314024
  // NOTE(joe): this function just allocates a closure, so it's stack-safe
314025
314025
  var onCompile = gmf(cpo, "make-on-compile").app(runtime.makeFunction(saveGDriveCachedFile, "save-gdrive-cached-file"));
314026
314026
 
314027
+ function maybeAppendSlash(s) {
314028
+ if(s.endsWith("/")) { return s; }
314029
+ return s + "/";
314030
+ }
314031
+
314032
+ function urlResolve(path, base) {
314033
+ return new URL(path, base).href;
314034
+ }
314035
+
314027
314036
  // NOTE(joe/ben): this function _used_ to be trivially stack safe, but files
314028
314037
  // need to resolve their absolute path to calculate their URI, which
314029
314038
  // requires an RPC, so this function is no-longer trivially flat
@@ -314072,7 +314081,7 @@ ${labelRow}`;
314072
314081
  return arr[0];
314073
314082
  }
314074
314083
  else if (protocol === "url-file") {
314075
- return arr[0] + "/" + arr[1];
314084
+ return urlResolve(arr[1], maybeAppendSlash(arr[0]));
314076
314085
  }
314077
314086
  else {
314078
314087
  console.error("Unknown import: ", dependency);
@@ -314130,7 +314139,7 @@ ${labelRow}`;
314130
314139
  return runtime.getField(runtime.getField(urlLoc, "values"), "url-locator").app(arr[0], replGlobals);
314131
314140
  }
314132
314141
  else if (protocol === "url-file") {
314133
- const fullUrl = arr[0] + "/" + arr[1];
314142
+ const fullUrl = urlResolve(arr[1], maybeAppendSlash(arr[0]));
314134
314143
  switch(urlFileMode) {
314135
314144
  case "all-remote":
314136
314145
  fetch(fullUrl).then(async (response) => {
@@ -314024,6 +314024,15 @@ ${labelRow}`;
314024
314024
  // NOTE(joe): this function just allocates a closure, so it's stack-safe
314025
314025
  var onCompile = gmf(cpo, "make-on-compile").app(runtime.makeFunction(saveGDriveCachedFile, "save-gdrive-cached-file"));
314026
314026
 
314027
+ function maybeAppendSlash(s) {
314028
+ if(s.endsWith("/")) { return s; }
314029
+ return s + "/";
314030
+ }
314031
+
314032
+ function urlResolve(path, base) {
314033
+ return new URL(path, base).href;
314034
+ }
314035
+
314027
314036
  // NOTE(joe/ben): this function _used_ to be trivially stack safe, but files
314028
314037
  // need to resolve their absolute path to calculate their URI, which
314029
314038
  // requires an RPC, so this function is no-longer trivially flat
@@ -314072,7 +314081,7 @@ ${labelRow}`;
314072
314081
  return arr[0];
314073
314082
  }
314074
314083
  else if (protocol === "url-file") {
314075
- return arr[0] + "/" + arr[1];
314084
+ return urlResolve(arr[1], maybeAppendSlash(arr[0]));
314076
314085
  }
314077
314086
  else {
314078
314087
  console.error("Unknown import: ", dependency);
@@ -314130,7 +314139,7 @@ ${labelRow}`;
314130
314139
  return runtime.getField(runtime.getField(urlLoc, "values"), "url-locator").app(arr[0], replGlobals);
314131
314140
  }
314132
314141
  else if (protocol === "url-file") {
314133
- const fullUrl = arr[0] + "/" + arr[1];
314142
+ const fullUrl = urlResolve(arr[1], maybeAppendSlash(arr[0]));
314134
314143
  switch(urlFileMode) {
314135
314144
  case "all-remote":
314136
314145
  fetch(fullUrl).then(async (response) => {