@hpcc-js/observablehq-compiler 1.2.3 → 1.2.5

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.
package/dist/index.esm.js CHANGED
@@ -6749,26 +6749,20 @@ function omd2notebook(omd) {
6749
6749
  })
6750
6750
  };
6751
6751
  }
6752
- function fetchEx(url, proxyPrefix = "https://observable-cors.glitch.me/", proxyPostfix = "") {
6753
- return fetch(url)
6754
- .then(response => {
6752
+ function fetchEx(url, proxyPrefix = "https://api.codetabs.com/v1/proxy/?quest=", proxyPostfix = "") {
6753
+ const matches = url.match(/^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n?]+)/img);
6754
+ return fetch(url, { headers: { origin: matches[0], referer: url } }).then(response => {
6755
6755
  if (response.ok)
6756
6756
  return response;
6757
6757
  throw new Error("CORS?");
6758
6758
  }).catch(e => {
6759
- const matches = url.match(/^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n?]+)/img);
6760
6759
  url = `${proxyPrefix}${url}${proxyPostfix}`;
6761
- return fetch(url, {
6762
- headers: {
6763
- origin: matches[0],
6764
- referer: url
6765
- }
6766
- });
6760
+ return fetch(url, { headers: { origin: matches[0], referer: url } });
6767
6761
  });
6768
6762
  }
6769
- function download(impUrl) {
6763
+ function download(impUrl, proxyPrefix, proxyPostfix) {
6770
6764
  const isShared = impUrl.indexOf("https://observablehq.com/d") === 0;
6771
- return fetchEx(impUrl.replace(`https://observablehq.com/${isShared ? "d/" : ""}`, "https://api.observablehq.com/document/"))
6765
+ return fetchEx(impUrl.replace(`https://observablehq.com/${isShared ? "d/" : ""}`, "https://api.observablehq.com/document/"), proxyPrefix, proxyPostfix)
6772
6766
  .then(r => r.json());
6773
6767
  }
6774
6768