@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hpcc-js/observablehq-compiler",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "hpcc-js - ObservableHQ Compiler (unoffical)",
5
5
  "keywords": [
6
6
  "observablehq",
@@ -57,13 +57,13 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@hpcc-js/observable-shim": "^2.5.0",
60
- "node-fetch": "3.2.10",
61
- "yargs": "17.6.0"
60
+ "node-fetch": "3.3.0",
61
+ "yargs": "17.6.2"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@hpcc-js/bundle": "^2.11.3",
65
65
  "@observablehq/runtime": "4.28.0",
66
- "tslib": "2.4.0"
66
+ "tslib": "2.4.1"
67
67
  },
68
68
  "repository": {
69
69
  "type": "git",
@@ -76,5 +76,5 @@
76
76
  "url": "https://github.com/hpcc-systems/Visualization/issues"
77
77
  },
78
78
  "homepage": "https://github.com/hpcc-systems/Visualization/tree/trunk/packages/observablehq-compiler",
79
- "gitHead": "b5b4cf9ee4257885b41a3f90c11cbe6609704d0d"
79
+ "gitHead": "c384273a6173ffe20db065979e0b76049099ef38"
80
80
  }
@@ -1,3 +1,3 @@
1
1
  export const PKG_NAME = "@hpcc-js/observablehq-compiler";
2
- export const PKG_VERSION = "1.2.3";
3
- export const BUILD_VERSION = "2.104.13";
2
+ export const PKG_VERSION = "1.2.5";
3
+ export const BUILD_VERSION = "2.104.15";
package/src/util.ts CHANGED
@@ -157,26 +157,20 @@ export function omd2notebook(omd: string): ohq.Notebook {
157
157
  } as ohq.Notebook;
158
158
  }
159
159
 
160
- export function fetchEx(url: string, proxyPrefix = "https://observable-cors.glitch.me/", proxyPostfix = "") {
161
- return fetch(url)
162
- .then(response => {
163
- if (response.ok) return response;
164
- throw new Error("CORS?");
165
- }).catch(e => {
166
- const matches = url.match(/^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n?]+)/img);
167
- url = `${proxyPrefix}${url}${proxyPostfix}`;
168
- return fetch(url, {
169
- headers: {
170
- origin: matches[0],
171
- referer: url
172
- }
173
- });
174
- });
160
+ export function fetchEx(url: string, proxyPrefix = "https://api.codetabs.com/v1/proxy/?quest=", proxyPostfix = "") {
161
+ const matches = url.match(/^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n?]+)/img);
162
+ return fetch(url, { headers: { origin: matches[0], referer: url } }).then(response => {
163
+ if (response.ok) return response;
164
+ throw new Error("CORS?");
165
+ }).catch(e => {
166
+ url = `${proxyPrefix}${url}${proxyPostfix}`;
167
+ return fetch(url, { headers: { origin: matches[0], referer: url } });
168
+ });
175
169
  }
176
170
 
177
- export function download(impUrl: string): Promise<ohq.Notebook> {
171
+ export function download(impUrl: string, proxyPrefix?: string, proxyPostfix?: string): Promise<ohq.Notebook> {
178
172
  const isShared = impUrl.indexOf("https://observablehq.com/d") === 0;
179
- return fetchEx(impUrl.replace(`https://observablehq.com/${isShared ? "d/" : ""}`, "https://api.observablehq.com/document/"))
173
+ return fetchEx(impUrl.replace(`https://observablehq.com/${isShared ? "d/" : ""}`, "https://api.observablehq.com/document/"), proxyPrefix, proxyPostfix)
180
174
  .then(r => r.json())
181
175
  ;
182
176
  }
@@ -1,4 +1,4 @@
1
1
  export declare const PKG_NAME = "@hpcc-js/observablehq-compiler";
2
- export declare const PKG_VERSION = "1.2.3";
3
- export declare const BUILD_VERSION = "2.104.13";
2
+ export declare const PKG_VERSION = "1.2.5";
3
+ export declare const BUILD_VERSION = "2.104.15";
4
4
  //# sourceMappingURL=__package__.d.ts.map
package/types/util.d.ts CHANGED
@@ -25,6 +25,6 @@ export declare function notebook2ojs(_: string): ParsedOJS[];
25
25
  export declare function ojs2notebook(ojs: string): ohq.Notebook;
26
26
  export declare function omd2notebook(omd: string): ohq.Notebook;
27
27
  export declare function fetchEx(url: string, proxyPrefix?: string, proxyPostfix?: string): Promise<Response>;
28
- export declare function download(impUrl: string): Promise<ohq.Notebook>;
28
+ export declare function download(impUrl: string, proxyPrefix?: string, proxyPostfix?: string): Promise<ohq.Notebook>;
29
29
  export {};
30
30
  //# sourceMappingURL=util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAiBpD,UAAU,GAAG;IACT,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,IAAI;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,GAAG,EAAE,CAAC;CAClB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,UAAQ,EAAE,SAAS,UAAQ,EAAE,cAAc,UAAQ,EAAE,IAAI,CAAC,EAAE,MAAM,OAYjH;AAQD,eAAO,MAAM,cAAc,SAAU,MAAM,YAAoB,CAAC;AAChE,eAAO,MAAM,cAAc,SAAU,MAAM,YAAY,MAAM,QAK5D,CAAC;AAGF,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,gBAEjD;AAED,UAAU,SAAS;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,GAAG,CAAC;CACd;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,UAIzC;AAgDD,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,CAGnD;AAED,wBAAgB,YAAY,CAAC,GAAG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EAAE,MAAM,GAAG,SAAS,EAAE,CAGnD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,QAAQ,CActD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,QAAQ,CActD;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,SAA8C,EAAE,YAAY,SAAK,qBAShH;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAK3G"}
@@ -1,4 +1,4 @@
1
1
  export declare const PKG_NAME = "@hpcc-js/observablehq-compiler";
2
- export declare const PKG_VERSION = "1.2.3";
3
- export declare const BUILD_VERSION = "2.104.13";
2
+ export declare const PKG_VERSION = "1.2.5";
3
+ export declare const BUILD_VERSION = "2.104.15";
4
4
  //# sourceMappingURL=__package__.d.ts.map
@@ -25,6 +25,6 @@ export declare function notebook2ojs(_: string): ParsedOJS[];
25
25
  export declare function ojs2notebook(ojs: string): ohq.Notebook;
26
26
  export declare function omd2notebook(omd: string): ohq.Notebook;
27
27
  export declare function fetchEx(url: string, proxyPrefix?: string, proxyPostfix?: string): Promise<Response>;
28
- export declare function download(impUrl: string): Promise<ohq.Notebook>;
28
+ export declare function download(impUrl: string, proxyPrefix?: string, proxyPostfix?: string): Promise<ohq.Notebook>;
29
29
  export {};
30
30
  //# sourceMappingURL=util.d.ts.map