@hpcc-js/observablehq-compiler 1.1.2 → 1.1.3
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 +70 -46
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +2 -2
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.js +70 -46
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/package.json +4 -4
- package/src/__package__.ts +2 -2
- package/src/__tests__/node.ts +2 -2
- package/src/compiler.md +4 -4
- package/src/compiler.ts +46 -31
- package/src/index.ts +1 -2
- package/src/util.ts +17 -7
- package/types/__package__.d.ts +2 -2
- package/types/compiler.d.ts +9 -6
- package/types/compiler.d.ts.map +1 -1
- package/types/index.d.ts +1 -2
- package/types/index.d.ts.map +1 -1
- package/types/util.d.ts +4 -1
- package/types/util.d.ts.map +1 -1
- package/types-3.4/__package__.d.ts +2 -2
- package/types-3.4/compiler.d.ts +8 -5
- package/types-3.4/index.d.ts +1 -2
- package/types-3.4/util.d.ts +4 -1
- package/src/__tests__/tsconfig.json +0 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/observablehq-compiler",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "hpcc-js - ObservableHQ Compiler (unoffical)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"observablehq",
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
"update": "npx --yes npm-check-updates -u -t minor"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@hpcc-js/observable-shim": "^2.3.
|
|
59
|
+
"@hpcc-js/observable-shim": "^2.3.1",
|
|
60
60
|
"node-fetch": "3.2.10",
|
|
61
61
|
"yargs": "17.5.1"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@hpcc-js/bundle": "^2.11.3",
|
|
65
65
|
"@hpcc-js/util": "^2.49.1",
|
|
66
|
-
"@observablehq/runtime": "4.
|
|
66
|
+
"@observablehq/runtime": "4.25.0",
|
|
67
67
|
"tslib": "2.4.0"
|
|
68
68
|
},
|
|
69
69
|
"repository": {
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"url": "https://github.com/hpcc-systems/Visualization/issues"
|
|
78
78
|
},
|
|
79
79
|
"homepage": "https://github.com/hpcc-systems/Visualization/tree/trunk/packages/observablehq-compiler",
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "6dde92103a18dcd317d307f841aeda4c2b8c3048"
|
|
81
81
|
}
|
package/src/__package__.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export const PKG_NAME = "@hpcc-js/observablehq-compiler";
|
|
2
|
-
export const PKG_VERSION = "1.1.
|
|
3
|
-
export const BUILD_VERSION = "2.104.
|
|
2
|
+
export const PKG_VERSION = "1.1.3";
|
|
3
|
+
export const BUILD_VERSION = "2.104.6";
|
package/src/__tests__/node.ts
CHANGED
package/src/compiler.md
CHANGED
|
@@ -107,12 +107,12 @@ Putting it all together:
|
|
|
107
107
|
mode: "js"
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
|
-
id:
|
|
110
|
+
id: 2,
|
|
111
111
|
value: "h = \"Hello\"",
|
|
112
112
|
mode: "js"
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
|
-
id:
|
|
115
|
+
id: 3,
|
|
116
116
|
value: "w = \"World\"",
|
|
117
117
|
mode: "js"
|
|
118
118
|
}
|
|
@@ -153,12 +153,12 @@ To output the generated code simply call `toString` on the compiled function:
|
|
|
153
153
|
mode: "js"
|
|
154
154
|
},
|
|
155
155
|
{
|
|
156
|
-
id:
|
|
156
|
+
id: 2,
|
|
157
157
|
value: "h = \"Hello\"",
|
|
158
158
|
mode: "js"
|
|
159
159
|
},
|
|
160
160
|
{
|
|
161
|
-
id:
|
|
161
|
+
id: 3,
|
|
162
162
|
value: "w = \"World\"",
|
|
163
163
|
mode: "js"
|
|
164
164
|
}
|
package/src/compiler.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ohq, splitModule } from "@hpcc-js/observable-shim";
|
|
2
2
|
|
|
3
3
|
import { endsWith, join } from "@hpcc-js/util";
|
|
4
4
|
import { parseCell, ParsedImportCell } from "./cst";
|
|
5
5
|
import { Writer } from "./writer";
|
|
6
6
|
import { encodeBacktick, fetchEx, obfuscatedImport, ojs2notebook, omd2notebook } from "./util";
|
|
7
7
|
|
|
8
|
+
const isRelativePath = (path: string) => path[0] === ".";
|
|
9
|
+
const fullUrl = (path: string, basePath: string) => isRelativePath(path) ? join(basePath, path) : path;
|
|
10
|
+
|
|
8
11
|
interface ImportDefine {
|
|
9
12
|
(runtime: ohq.Runtime, inspector?: ohq.InspectorFactory): ohq.Module;
|
|
10
13
|
dispose: () => void;
|
|
@@ -12,7 +15,7 @@ interface ImportDefine {
|
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
async function importFile(relativePath: string, baseUrl: string) {
|
|
15
|
-
const path =
|
|
18
|
+
const path = fullUrl(relativePath, baseUrl);
|
|
16
19
|
const content = await fetchEx(path).then(r => r.text());
|
|
17
20
|
let notebook: ohq.Notebook;
|
|
18
21
|
if (endsWith(relativePath, ".ojsnb")) {
|
|
@@ -126,7 +129,7 @@ function createImportVariable(name?: string, alias?: string) {
|
|
|
126
129
|
type ImportVariableFunc = ReturnType<typeof createImportVariable>;
|
|
127
130
|
|
|
128
131
|
async function createModule(parsed: ParsedImportCell, text: string, baseUrl: string) {
|
|
129
|
-
const otherModule =
|
|
132
|
+
const otherModule = isRelativePath(parsed.src) ?
|
|
130
133
|
await importFile(parsed.src, baseUrl) :
|
|
131
134
|
await importCompiledNotebook(parsed.src);
|
|
132
135
|
|
|
@@ -175,31 +178,36 @@ async function createCell(node: ohq.Node, baseUrl: string) {
|
|
|
175
178
|
const variables: VariableFunc[] = [];
|
|
176
179
|
try {
|
|
177
180
|
const text = node.mode && node.mode !== "js" ? `${node.mode}\`${encodeBacktick(node.value)}\`` : node.value;
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
181
|
+
const parsedModule = splitModule(text);
|
|
182
|
+
for (const text of parsedModule) {
|
|
183
|
+
const parsed = parseCell(text);
|
|
184
|
+
switch (parsed.type) {
|
|
185
|
+
case "import":
|
|
186
|
+
modules.push(await createModule(parsed, text, baseUrl));
|
|
187
|
+
break;
|
|
188
|
+
case "viewof":
|
|
189
|
+
variables.push(createVariable(true, parsed.variable.id, parsed.variable.inputs, parsed.variable.func));
|
|
190
|
+
variables.push(createVariable(false, parsed.variableValue.id, parsed.variableValue.inputs, parsed.variableValue.func, true));
|
|
191
|
+
break;
|
|
192
|
+
case "mutable":
|
|
193
|
+
variables.push(createVariable(false, parsed.initial.id, parsed.initial.inputs, parsed.initial.func));
|
|
194
|
+
variables.push(createVariable(false, parsed.variable.id, parsed.variable.inputs, parsed.variable.func));
|
|
195
|
+
variables.push(createVariable(true, parsed.variableValue.id, parsed.variableValue.inputs, parsed.variableValue.func, true));
|
|
196
|
+
break;
|
|
197
|
+
case "variable":
|
|
198
|
+
variables.push(createVariable(true, parsed.id, parsed.inputs, parsed.func));
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
195
201
|
}
|
|
196
202
|
} catch (e) {
|
|
203
|
+
variables.push(createVariable(true, undefined, [], e.message));
|
|
197
204
|
}
|
|
198
205
|
|
|
199
206
|
const retVal = (runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory) => {
|
|
200
207
|
modules.forEach(imp => imp(runtime, main, inspector));
|
|
201
208
|
variables.forEach(v => v(main, inspector));
|
|
202
209
|
};
|
|
210
|
+
retVal.id = "" + node.id;
|
|
203
211
|
retVal.modules = modules;
|
|
204
212
|
retVal.variables = variables;
|
|
205
213
|
retVal.dispose = () => {
|
|
@@ -214,23 +222,26 @@ async function createCell(node: ohq.Node, baseUrl: string) {
|
|
|
214
222
|
}
|
|
215
223
|
export type CellFunc = Awaited<ReturnType<typeof createCell>>;
|
|
216
224
|
|
|
217
|
-
function createFile(file: ohq.File): [string, any] {
|
|
225
|
+
function createFile(file: ohq.File, baseUrl: string): [string, any] {
|
|
218
226
|
function toString() { return globalThis.url; }
|
|
219
|
-
return [file.name, { url: new URL(file.url), mimeType: file.mime_type, toString }];
|
|
227
|
+
return [file.name, { url: new URL(fullUrl(file.url, baseUrl)), mimeType: file.mime_type, toString }];
|
|
220
228
|
}
|
|
221
229
|
export type FileFunc = ReturnType<typeof createFile>;
|
|
222
230
|
|
|
223
231
|
export async function compile(notebook: ohq.Notebook, baseUrl: string = ".") {
|
|
224
232
|
|
|
225
|
-
const files = notebook.files.map(f => createFile(f));
|
|
233
|
+
const files = notebook.files.map(f => createFile(f, baseUrl));
|
|
226
234
|
const fileAttachments = new Map<string, any>(files);
|
|
227
|
-
|
|
235
|
+
const _cells: CellFunc[] = await Promise.all(notebook.nodes.map(n => createCell(n, baseUrl)));
|
|
236
|
+
const cells = new Map<string, CellFunc>(_cells.map(c => [c.id, c]));
|
|
228
237
|
|
|
229
238
|
const retVal = (runtime: ohq.Runtime, inspector?: ohq.InspectorFactory): ohq.Module => {
|
|
230
239
|
const main = runtime.module();
|
|
231
240
|
main.builtin("FileAttachment", runtime.fileAttachments(name => {
|
|
232
|
-
return fileAttachments.get(name) ?? { url: new URL(name), mimeType: null };
|
|
241
|
+
return fileAttachments.get(name) ?? { url: new URL(fullUrl(name, baseUrl)), mimeType: null };
|
|
233
242
|
}));
|
|
243
|
+
main.builtin("fetchEx", fetchEx);
|
|
244
|
+
|
|
234
245
|
cells.forEach(cell => {
|
|
235
246
|
cell(runtime, main, inspector);
|
|
236
247
|
});
|
|
@@ -238,18 +249,22 @@ export async function compile(notebook: ohq.Notebook, baseUrl: string = ".") {
|
|
|
238
249
|
};
|
|
239
250
|
retVal.fileAttachments = fileAttachments;
|
|
240
251
|
retVal.cells = cells;
|
|
241
|
-
retVal.appendCell = async (n: ohq.Node, baseUrl
|
|
252
|
+
retVal.appendCell = async (n: ohq.Node, baseUrl) => {
|
|
242
253
|
const cell = await createCell(n, baseUrl);
|
|
243
|
-
|
|
254
|
+
retVal.disposeCell(cell.id);
|
|
255
|
+
cells.set(cell.id, cell);
|
|
244
256
|
return cell;
|
|
245
257
|
};
|
|
246
|
-
retVal.disposeCell = async (
|
|
247
|
-
|
|
248
|
-
cell
|
|
258
|
+
retVal.disposeCell = async (id: string) => {
|
|
259
|
+
const cell = cells.get(id);
|
|
260
|
+
if (cell) {
|
|
261
|
+
cells.delete(id);
|
|
262
|
+
cell.dispose();
|
|
263
|
+
}
|
|
249
264
|
};
|
|
250
265
|
retVal.dispose = () => {
|
|
251
266
|
cells.forEach(cell => cell.dispose());
|
|
252
|
-
cells
|
|
267
|
+
cells.clear();
|
|
253
268
|
};
|
|
254
269
|
retVal.write = (w: Writer) => {
|
|
255
270
|
w.files(notebook.files);
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export type { ohq } from "@hpcc-js/observable-shim";
|
|
2
2
|
|
|
3
3
|
export * from "./compiler";
|
|
4
|
-
export { ojs2notebook, omd2notebook, download } from "./util";
|
|
5
|
-
export * from "./writer";
|
|
4
|
+
export { ojs2notebook, omd2notebook, parseOmd, download } from "./util";
|
|
6
5
|
|
|
7
6
|
import "../src/index.css";
|
package/src/util.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ohq } from "@hpcc-js/observable-shim";
|
|
2
|
-
import {
|
|
2
|
+
import { parseCell, splitModule } from "@hpcc-js/observable-shim";
|
|
3
3
|
|
|
4
4
|
const FuncTypes = {
|
|
5
5
|
functionType: Object.getPrototypeOf(function () { }).constructor,
|
|
@@ -50,6 +50,8 @@ interface ParsedOJS {
|
|
|
50
50
|
ojs: string;
|
|
51
51
|
offset: number;
|
|
52
52
|
inlineMD: boolean;
|
|
53
|
+
cell: any;
|
|
54
|
+
error: any;
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
export function encodeBacktick(str: string) {
|
|
@@ -59,14 +61,23 @@ export function encodeBacktick(str: string) {
|
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
function createParsedOJS(ojs: string, offset: number, inlineMD: boolean): ParsedOJS {
|
|
64
|
+
let cell;
|
|
65
|
+
let error;
|
|
66
|
+
try {
|
|
67
|
+
cell = parseCell(ojs);
|
|
68
|
+
} catch (e) {
|
|
69
|
+
error = e;
|
|
70
|
+
}
|
|
62
71
|
return {
|
|
63
72
|
ojs,
|
|
64
73
|
offset,
|
|
65
|
-
inlineMD
|
|
74
|
+
inlineMD,
|
|
75
|
+
cell,
|
|
76
|
+
error
|
|
66
77
|
};
|
|
67
78
|
}
|
|
68
79
|
|
|
69
|
-
function parseOmd(_: string): ParsedOJS[] {
|
|
80
|
+
export function parseOmd(_: string): ParsedOJS[] {
|
|
70
81
|
const retVal: ParsedOJS[] = [];
|
|
71
82
|
// Load Markdown ---
|
|
72
83
|
const re = /(```(?:\s|\S)[\s\S]*?```)/g;
|
|
@@ -101,7 +112,7 @@ export function notebook2ojs(_: string): ParsedOJS[] {
|
|
|
101
112
|
}
|
|
102
113
|
|
|
103
114
|
export function ojs2notebook(ojs: string): ohq.Notebook {
|
|
104
|
-
const cells =
|
|
115
|
+
const cells = splitModule(ojs);
|
|
105
116
|
return {
|
|
106
117
|
files: [],
|
|
107
118
|
nodes: cells.map((cell, idx) => {
|
|
@@ -128,14 +139,14 @@ export function omd2notebook(omd: string): ohq.Notebook {
|
|
|
128
139
|
} as ohq.Notebook;
|
|
129
140
|
}
|
|
130
141
|
|
|
131
|
-
export function fetchEx(url: string) {
|
|
142
|
+
export function fetchEx(url: string, proxyPrefix = "https://observable-cors.glitch.me/", proxyPostfix = "") {
|
|
132
143
|
return fetch(url)
|
|
133
144
|
.then(response => {
|
|
134
145
|
if (response.ok) return response;
|
|
135
146
|
throw new Error("CORS?");
|
|
136
147
|
}).catch(e => {
|
|
137
148
|
const matches = url.match(/^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n?]+)/img);
|
|
138
|
-
url =
|
|
149
|
+
url = `${proxyPrefix}${url}${proxyPostfix}`;
|
|
139
150
|
return fetch(url, {
|
|
140
151
|
headers: {
|
|
141
152
|
origin: matches[0],
|
|
@@ -150,5 +161,4 @@ export function download(impUrl: string): Promise<ohq.Notebook> {
|
|
|
150
161
|
return fetchEx(impUrl.replace(`https://observablehq.com/${isShared ? "d/" : ""}`, "https://api.observablehq.com/document/"))
|
|
151
162
|
.then(r => r.json())
|
|
152
163
|
;
|
|
153
|
-
|
|
154
164
|
}
|
package/types/__package__.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const PKG_NAME = "@hpcc-js/observablehq-compiler";
|
|
2
|
-
export declare const PKG_VERSION = "1.1.
|
|
3
|
-
export declare const BUILD_VERSION = "2.104.
|
|
2
|
+
export declare const PKG_VERSION = "1.1.3";
|
|
3
|
+
export declare const BUILD_VERSION = "2.104.6";
|
|
4
4
|
//# sourceMappingURL=__package__.d.ts.map
|
package/types/compiler.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ohq } from "@hpcc-js/observable-shim";
|
|
2
2
|
import { Writer } from "./writer";
|
|
3
3
|
declare function createCell(node: ohq.Node, baseUrl: string): Promise<{
|
|
4
4
|
(runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): void;
|
|
5
|
+
id: string;
|
|
5
6
|
modules: {
|
|
6
7
|
(runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Module;
|
|
7
8
|
importVariables: {
|
|
@@ -25,13 +26,14 @@ declare function createCell(node: ohq.Node, baseUrl: string): Promise<{
|
|
|
25
26
|
write(w: Writer): void;
|
|
26
27
|
}>;
|
|
27
28
|
export declare type CellFunc = Awaited<ReturnType<typeof createCell>>;
|
|
28
|
-
declare function createFile(file: ohq.File): [string, any];
|
|
29
|
+
declare function createFile(file: ohq.File, baseUrl: string): [string, any];
|
|
29
30
|
export declare type FileFunc = ReturnType<typeof createFile>;
|
|
30
31
|
export declare function compile(notebook: ohq.Notebook, baseUrl?: string): Promise<{
|
|
31
32
|
(runtime: ohq.Runtime, inspector?: ohq.InspectorFactory): ohq.Module;
|
|
32
33
|
fileAttachments: Map<string, any>;
|
|
33
|
-
cells: {
|
|
34
|
+
cells: Map<string, {
|
|
34
35
|
(runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): void;
|
|
36
|
+
id: string;
|
|
35
37
|
modules: {
|
|
36
38
|
(runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Module;
|
|
37
39
|
importVariables: {
|
|
@@ -53,9 +55,10 @@ export declare function compile(notebook: ohq.Notebook, baseUrl?: string): Promi
|
|
|
53
55
|
}[];
|
|
54
56
|
dispose(): void;
|
|
55
57
|
write(w: Writer): void;
|
|
56
|
-
}
|
|
57
|
-
appendCell(n: ohq.Node, baseUrl
|
|
58
|
+
}>;
|
|
59
|
+
appendCell(n: ohq.Node, baseUrl: any): Promise<{
|
|
58
60
|
(runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): void;
|
|
61
|
+
id: string;
|
|
59
62
|
modules: {
|
|
60
63
|
(runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Module;
|
|
61
64
|
importVariables: {
|
|
@@ -78,7 +81,7 @@ export declare function compile(notebook: ohq.Notebook, baseUrl?: string): Promi
|
|
|
78
81
|
dispose(): void;
|
|
79
82
|
write(w: Writer): void;
|
|
80
83
|
}>;
|
|
81
|
-
disposeCell(
|
|
84
|
+
disposeCell(id: string): Promise<void>;
|
|
82
85
|
dispose(): void;
|
|
83
86
|
write(w: Writer): void;
|
|
84
87
|
toString(w?: Writer): string;
|
package/types/compiler.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../src/compiler.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../src/compiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAe,MAAM,0BAA0B,CAAC;AAI5D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AA2KlC,iBAAe,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM;cA8B5B,IAAI,OAAO,QAAQ,IAAI,MAAM,cAAc,IAAI,gBAAgB;;;;;;;;;;;;;;;;;;;;;;aAWrE,MAAM;GAK5B;AACD,oBAAY,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;AAE9D,iBAAS,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAGlE;AACD,oBAAY,QAAQ,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAErD,wBAAsB,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,OAAO,GAAE,MAAY;cAO9C,IAAI,OAAO,cAAc,IAAI,gBAAgB,GAAG,IAAI,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAcrD,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;oBAMN,MAAM;;aAWnB,MAAM;;GAS5B;AACD,oBAAY,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC"}
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export type { ohq } from "@hpcc-js/observable-shim";
|
|
2
2
|
export * from "./compiler";
|
|
3
|
-
export { ojs2notebook, omd2notebook, download } from "./util";
|
|
4
|
-
export * from "./writer";
|
|
3
|
+
export { ojs2notebook, omd2notebook, parseOmd, download } from "./util";
|
|
5
4
|
import "../src/index.css";
|
|
6
5
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAEpD,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAEpD,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAExE,OAAO,kBAAkB,CAAC"}
|
package/types/util.d.ts
CHANGED
|
@@ -15,12 +15,15 @@ interface ParsedOJS {
|
|
|
15
15
|
ojs: string;
|
|
16
16
|
offset: number;
|
|
17
17
|
inlineMD: boolean;
|
|
18
|
+
cell: any;
|
|
19
|
+
error: any;
|
|
18
20
|
}
|
|
19
21
|
export declare function encodeBacktick(str: string): string;
|
|
22
|
+
export declare function parseOmd(_: string): ParsedOJS[];
|
|
20
23
|
export declare function notebook2ojs(_: string): ParsedOJS[];
|
|
21
24
|
export declare function ojs2notebook(ojs: string): ohq.Notebook;
|
|
22
25
|
export declare function omd2notebook(omd: string): ohq.Notebook;
|
|
23
|
-
export declare function fetchEx(url: string): Promise<Response>;
|
|
26
|
+
export declare function fetchEx(url: string, proxyPrefix?: string, proxyPostfix?: string): Promise<Response>;
|
|
24
27
|
export declare function download(impUrl: string): Promise<ohq.Notebook>;
|
|
25
28
|
export {};
|
|
26
29
|
//# sourceMappingURL=util.d.ts.map
|
package/types/util.d.ts.map
CHANGED
|
@@ -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;AAGD,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;
|
|
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;AAGD,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;AAmBD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,CA2B/C;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,CAGnD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,QAAQ,CAYtD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,QAAQ,CAYtD;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,SAAuC,EAAE,YAAY,SAAK,qBAezG;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAK9D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const PKG_NAME = "@hpcc-js/observablehq-compiler";
|
|
2
|
-
export declare const PKG_VERSION = "1.1.
|
|
3
|
-
export declare const BUILD_VERSION = "2.104.
|
|
2
|
+
export declare const PKG_VERSION = "1.1.3";
|
|
3
|
+
export declare const BUILD_VERSION = "2.104.6";
|
|
4
4
|
//# sourceMappingURL=__package__.d.ts.map
|
package/types-3.4/compiler.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ohq } from "@hpcc-js/observable-shim";
|
|
|
2
2
|
import { Writer } from "./writer";
|
|
3
3
|
declare function createCell(node: ohq.Node, baseUrl: string): Promise<{
|
|
4
4
|
(runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): void;
|
|
5
|
+
id: string;
|
|
5
6
|
modules: {
|
|
6
7
|
(runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Module;
|
|
7
8
|
importVariables: {
|
|
@@ -25,7 +26,7 @@ declare function createCell(node: ohq.Node, baseUrl: string): Promise<{
|
|
|
25
26
|
write(w: Writer): void;
|
|
26
27
|
}>;
|
|
27
28
|
export declare type CellFunc = Awaited<ReturnType<typeof createCell>>;
|
|
28
|
-
declare function createFile(file: ohq.File): [
|
|
29
|
+
declare function createFile(file: ohq.File, baseUrl: string): [
|
|
29
30
|
string,
|
|
30
31
|
any
|
|
31
32
|
];
|
|
@@ -33,8 +34,9 @@ export declare type FileFunc = ReturnType<typeof createFile>;
|
|
|
33
34
|
export declare function compile(notebook: ohq.Notebook, baseUrl?: string): Promise<{
|
|
34
35
|
(runtime: ohq.Runtime, inspector?: ohq.InspectorFactory): ohq.Module;
|
|
35
36
|
fileAttachments: Map<string, any>;
|
|
36
|
-
cells: {
|
|
37
|
+
cells: Map<string, {
|
|
37
38
|
(runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): void;
|
|
39
|
+
id: string;
|
|
38
40
|
modules: {
|
|
39
41
|
(runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Module;
|
|
40
42
|
importVariables: {
|
|
@@ -56,9 +58,10 @@ export declare function compile(notebook: ohq.Notebook, baseUrl?: string): Promi
|
|
|
56
58
|
}[];
|
|
57
59
|
dispose(): void;
|
|
58
60
|
write(w: Writer): void;
|
|
59
|
-
}
|
|
60
|
-
appendCell(n: ohq.Node, baseUrl
|
|
61
|
+
}>;
|
|
62
|
+
appendCell(n: ohq.Node, baseUrl: any): Promise<{
|
|
61
63
|
(runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): void;
|
|
64
|
+
id: string;
|
|
62
65
|
modules: {
|
|
63
66
|
(runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Module;
|
|
64
67
|
importVariables: {
|
|
@@ -81,7 +84,7 @@ export declare function compile(notebook: ohq.Notebook, baseUrl?: string): Promi
|
|
|
81
84
|
dispose(): void;
|
|
82
85
|
write(w: Writer): void;
|
|
83
86
|
}>;
|
|
84
|
-
disposeCell(
|
|
87
|
+
disposeCell(id: string): Promise<void>;
|
|
85
88
|
dispose(): void;
|
|
86
89
|
write(w: Writer): void;
|
|
87
90
|
toString(w?: Writer): string;
|
package/types-3.4/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { ohq } from "@hpcc-js/observable-shim";
|
|
2
2
|
export * from "./compiler";
|
|
3
|
-
export { ojs2notebook, omd2notebook, download } from "./util";
|
|
4
|
-
export * from "./writer";
|
|
3
|
+
export { ojs2notebook, omd2notebook, parseOmd, download } from "./util";
|
|
5
4
|
import "../src/index.css";
|
|
6
5
|
//# sourceMappingURL=index.d.ts.map
|
package/types-3.4/util.d.ts
CHANGED
|
@@ -15,12 +15,15 @@ interface ParsedOJS {
|
|
|
15
15
|
ojs: string;
|
|
16
16
|
offset: number;
|
|
17
17
|
inlineMD: boolean;
|
|
18
|
+
cell: any;
|
|
19
|
+
error: any;
|
|
18
20
|
}
|
|
19
21
|
export declare function encodeBacktick(str: string): string;
|
|
22
|
+
export declare function parseOmd(_: string): ParsedOJS[];
|
|
20
23
|
export declare function notebook2ojs(_: string): ParsedOJS[];
|
|
21
24
|
export declare function ojs2notebook(ojs: string): ohq.Notebook;
|
|
22
25
|
export declare function omd2notebook(omd: string): ohq.Notebook;
|
|
23
|
-
export declare function fetchEx(url: string): Promise<Response>;
|
|
26
|
+
export declare function fetchEx(url: string, proxyPrefix?: string, proxyPostfix?: string): Promise<Response>;
|
|
24
27
|
export declare function download(impUrl: string): Promise<ohq.Notebook>;
|
|
25
28
|
export {};
|
|
26
29
|
//# sourceMappingURL=util.d.ts.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../tsconfig.settings.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"rootDir": "./src",
|
|
5
|
-
"outDir": "./lib-umd",
|
|
6
|
-
"declarationDir": "./types",
|
|
7
|
-
"target": "ES2018",
|
|
8
|
-
"noImplicitThis": true,
|
|
9
|
-
"resolveJsonModule": true,
|
|
10
|
-
"lib": [
|
|
11
|
-
"dom",
|
|
12
|
-
"ES2018"
|
|
13
|
-
],
|
|
14
|
-
"types": [
|
|
15
|
-
"mocha"
|
|
16
|
-
]
|
|
17
|
-
},
|
|
18
|
-
"include": [
|
|
19
|
-
"./src/**/*"
|
|
20
|
-
]
|
|
21
|
-
}
|