@hpcc-js/observablehq-compiler 1.1.4 → 1.2.1

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.
@@ -1,88 +1,157 @@
1
1
  import { ohq } from "@hpcc-js/observable-shim";
2
2
  import { Writer } from "./writer";
3
- declare function createCell(node: ohq.Node, baseUrl: string): Promise<{
4
- (runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): void;
5
- id: string;
3
+ export declare type InspectorFactoryEx = (name: string | undefined, id: string | number) => Inspector;
4
+ export interface Inspector {
5
+ _node?: HTMLDivElement;
6
+ pending(): any;
7
+ fulfilled(value: any): any;
8
+ rejected(error: any): any;
9
+ }
10
+ declare function createCell(node: ohq.Node, options: CompileOptions): Promise<{
11
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): void;
12
+ id: string | number;
6
13
  modules: {
7
- (runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Module;
14
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): ohq.Module;
8
15
  importVariables: {
9
16
  (main: ohq.Module, otherModule: ohq.Module): void;
10
- dispose(): void;
17
+ delete(): void;
11
18
  }[];
12
19
  variables: {
13
- (module: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Variable;
14
- dispose(): void;
20
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
21
+ delete(): void;
15
22
  write(w: Writer): void;
16
23
  }[];
17
- dispose(): void;
24
+ delete(): void;
18
25
  write(w: Writer): void;
19
26
  }[];
20
27
  variables: {
21
- (module: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Variable;
22
- dispose(): void;
28
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
29
+ delete(): void;
23
30
  write(w: Writer): void;
24
31
  }[];
25
- dispose(): void;
32
+ delete(): void;
26
33
  write(w: Writer): void;
27
34
  }>;
28
35
  export declare type CellFunc = Awaited<ReturnType<typeof createCell>>;
29
- declare function createFile(file: ohq.File, baseUrl: string): [string, any];
30
- export declare type FileFunc = ReturnType<typeof createFile>;
31
- export declare function compile(notebook: ohq.Notebook, baseUrl?: string): Promise<{
32
- (runtime: ohq.Runtime, inspector?: ohq.InspectorFactory): ohq.Module;
36
+ export interface CompileOptions {
37
+ baseUrl?: string;
38
+ importMode?: "recursive" | "precompiled";
39
+ }
40
+ export declare function notebook(_files?: ohq.File[], _cells?: CellFunc[], { baseUrl, importMode }?: CompileOptions): {
41
+ (runtime: ohq.Runtime, inspector?: InspectorFactoryEx): ohq.Module;
33
42
  fileAttachments: Map<string, any>;
34
- cells: Map<string, {
35
- (runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): void;
36
- id: string;
43
+ cells: Map<string | number, {
44
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): void;
45
+ id: string | number;
37
46
  modules: {
38
- (runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Module;
47
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): ohq.Module;
39
48
  importVariables: {
40
49
  (main: ohq.Module, otherModule: ohq.Module): void;
41
- dispose(): void;
50
+ delete(): void;
42
51
  }[];
43
52
  variables: {
44
- (module: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Variable;
45
- dispose(): void;
53
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
54
+ delete(): void;
46
55
  write(w: Writer): void;
47
56
  }[];
48
- dispose(): void;
57
+ delete(): void;
49
58
  write(w: Writer): void;
50
59
  }[];
51
60
  variables: {
52
- (module: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Variable;
53
- dispose(): void;
61
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
62
+ delete(): void;
54
63
  write(w: Writer): void;
55
64
  }[];
56
- dispose(): void;
65
+ delete(): void;
57
66
  write(w: Writer): void;
58
67
  }>;
59
- appendCell(n: ohq.Node, baseUrl: any): Promise<{
60
- (runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): void;
61
- id: string;
68
+ set(n: ohq.Node): Promise<CellFunc>;
69
+ get(id: string | number): CellFunc;
70
+ delete(id: string | number): boolean;
71
+ clear(): void;
72
+ write(w: Writer): void;
73
+ toString(w?: Writer): string;
74
+ };
75
+ export declare function compile(notebookOrOjs: ohq.Notebook | string, { baseUrl, importMode }?: CompileOptions): Promise<{
76
+ (runtime: ohq.Runtime, inspector?: InspectorFactoryEx): ohq.Module;
77
+ fileAttachments: Map<string, any>;
78
+ cells: Map<string | number, {
79
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): void;
80
+ id: string | number;
81
+ modules: {
82
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): ohq.Module;
83
+ importVariables: {
84
+ (main: ohq.Module, otherModule: ohq.Module): void;
85
+ delete(): void;
86
+ }[];
87
+ variables: {
88
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
89
+ delete(): void;
90
+ write(w: Writer): void;
91
+ }[];
92
+ delete(): void;
93
+ write(w: Writer): void;
94
+ }[];
95
+ variables: {
96
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
97
+ delete(): void;
98
+ write(w: Writer): void;
99
+ }[];
100
+ delete(): void;
101
+ write(w: Writer): void;
102
+ }>;
103
+ set(n: ohq.Node): Promise<{
104
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): void;
105
+ id: string | number;
62
106
  modules: {
63
- (runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Module;
107
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): ohq.Module;
64
108
  importVariables: {
65
109
  (main: ohq.Module, otherModule: ohq.Module): void;
66
- dispose(): void;
110
+ delete(): void;
67
111
  }[];
68
112
  variables: {
69
- (module: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Variable;
70
- dispose(): void;
113
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
114
+ delete(): void;
71
115
  write(w: Writer): void;
72
116
  }[];
73
- dispose(): void;
117
+ delete(): void;
74
118
  write(w: Writer): void;
75
119
  }[];
76
120
  variables: {
77
- (module: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Variable;
78
- dispose(): void;
121
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
122
+ delete(): void;
79
123
  write(w: Writer): void;
80
124
  }[];
81
- dispose(): void;
125
+ delete(): void;
82
126
  write(w: Writer): void;
83
127
  }>;
84
- disposeCell(id: string): Promise<void>;
85
- dispose(): void;
128
+ get(id: string | number): {
129
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): void;
130
+ id: string | number;
131
+ modules: {
132
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): ohq.Module;
133
+ importVariables: {
134
+ (main: ohq.Module, otherModule: ohq.Module): void;
135
+ delete(): void;
136
+ }[];
137
+ variables: {
138
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
139
+ delete(): void;
140
+ write(w: Writer): void;
141
+ }[];
142
+ delete(): void;
143
+ write(w: Writer): void;
144
+ }[];
145
+ variables: {
146
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
147
+ delete(): void;
148
+ write(w: Writer): void;
149
+ }[];
150
+ delete(): void;
151
+ write(w: Writer): void;
152
+ };
153
+ delete(id: string | number): boolean;
154
+ clear(): void;
86
155
  write(w: Writer): void;
87
156
  toString(w?: Writer): string;
88
157
  }>;
@@ -1 +1 @@
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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;AAoLD,iBAAe,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,cAAc;cA8BpC,IAAI,OAAO,QAAQ,IAAI,MAAM,cAAc,kBAAkB;;;;;;;;;;;;;;;;;;;;;;aAWnE,MAAM;GAK5B;AACD,oBAAY,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;AAU9D,MAAM,WAAW,cAAc;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,WAAW,GAAG,aAAa,CAAC;CAC5C;AACD,wBAAgB,QAAQ,CAAC,MAAM,GAAE,GAAG,CAAC,IAAI,EAAO,EAAE,MAAM,GAAE,QAAQ,EAAO,EAAE,EAAE,OAAa,EAAE,UAA0B,EAAE,GAAE,cAAmB;cAKhH,IAAI,OAAO,cAAc,kBAAkB,GAAG,IAAI,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;WAc1D,QAAQ,GAAG,QAAQ,QAAQ,CAAC;YAMjC,MAAM,GAAG,MAAM,GAAG,QAAQ;eAGvB,MAAM,GAAG,MAAM,GAAG,OAAO;;aAY3B,MAAM;;EAS5B;AAED,wBAAsB,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,QAAQ,GAAG,MAAM,EAAE,EAAE,OAAa,EAAE,UAA0B,EAAE,GAAE,cAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIrI;AACD,oBAAY,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC"}
package/types/cst.d.ts CHANGED
@@ -37,6 +37,6 @@ interface ParsedVariableCell extends ParsedCell {
37
37
  inputs: string[];
38
38
  func: any;
39
39
  }
40
- export declare function parseCell(cellStr: string): ParsedImportCell | ParsedViewCell | ParsedMutableCell | ParsedVariableCell;
40
+ export declare function parseCell(cellStr: string, baseUrl: string): ParsedImportCell | ParsedViewCell | ParsedMutableCell | ParsedVariableCell;
41
41
  export {};
42
42
  //# sourceMappingURL=cst.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cst.d.ts","sourceRoot":"","sources":["../src/cst.ts"],"names":[],"mappings":"AA0CA,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CAAA;CACpE;AAED,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAChD,IAAI,EAAE,QAAQ,CAAA;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC9D,UAAU,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACjD;AAsBD,MAAM,WAAW,cAAe,SAAQ,UAAU;IAC9C,IAAI,EAAE,UAAU,CAAA;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,EAAE,GAAG,CAAC;CACb;AAED,MAAM,WAAW,cAAe,SAAQ,UAAU;IAC9C,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,cAAc,CAAC;IACzB,aAAa,EAAE,cAAc,CAAC;CACjC;AAqBD,UAAU,iBAAkB,SAAQ,UAAU;IAC1C,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,cAAc,CAAC;IACzB,aAAa,EAAE,cAAc,CAAC;CACjC;AA6BD,UAAU,kBAAmB,SAAQ,UAAU;IAC3C,IAAI,EAAE,UAAU,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM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MAAM,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,EAAE,GAAG,CAAC;CACb;AAWD,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,gBAAgB,GAAG,cAAc,GAAG,iBAAiB,GAAG,kBAAkB,CAmBtI"}
package/types/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type { ohq } from "@hpcc-js/observable-shim";
2
2
  export * from "./compiler";
3
- export { ojs2notebook, omd2notebook, parseOmd, download } from "./util";
3
+ export { ojs2notebook, omd2notebook, download } from "./util";
4
4
  import "../src/index.css";
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -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,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAExE,OAAO,kBAAkB,CAAC"}
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,MAAM,QAAQ,CAAC;AAE9D,OAAO,kBAAkB,CAAC"}
package/types/util.d.ts CHANGED
@@ -10,6 +10,8 @@ export interface Refs {
10
10
  patches: Ref[];
11
11
  }
12
12
  export declare function createFunction(refs: Refs, async?: boolean, generator?: boolean, blockStatement?: boolean, body?: string): any;
13
+ export declare const isRelativePath: (path: string) => boolean;
14
+ export declare const fixRelativeUrl: (path: string, basePath: string) => any;
13
15
  export declare function obfuscatedImport(url: string): Promise<any>;
14
16
  interface ParsedOJS {
15
17
  ojs: string;
@@ -19,7 +21,6 @@ interface ParsedOJS {
19
21
  error: any;
20
22
  }
21
23
  export declare function encodeBacktick(str: string): string;
22
- export declare function parseOmd(_: string): ParsedOJS[];
23
24
  export declare function notebook2ojs(_: string): ParsedOJS[];
24
25
  export declare function ojs2notebook(ojs: string): ohq.Notebook;
25
26
  export declare function omd2notebook(omd: string): ohq.Notebook;
@@ -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;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,QA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,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,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.4";
3
- export declare const BUILD_VERSION = "2.104.8";
2
+ export declare const PKG_VERSION = "1.2.1";
3
+ export declare const BUILD_VERSION = "2.104.10";
4
4
  //# sourceMappingURL=__package__.d.ts.map
@@ -1,91 +1,157 @@
1
1
  import { ohq } from "@hpcc-js/observable-shim";
2
2
  import { Writer } from "./writer";
3
- declare function createCell(node: ohq.Node, baseUrl: string): Promise<{
4
- (runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): void;
5
- id: string;
3
+ export declare type InspectorFactoryEx = (name: string | undefined, id: string | number) => Inspector;
4
+ export interface Inspector {
5
+ _node?: HTMLDivElement;
6
+ pending(): any;
7
+ fulfilled(value: any): any;
8
+ rejected(error: any): any;
9
+ }
10
+ declare function createCell(node: ohq.Node, options: CompileOptions): Promise<{
11
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): void;
12
+ id: string | number;
6
13
  modules: {
7
- (runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Module;
14
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): ohq.Module;
8
15
  importVariables: {
9
16
  (main: ohq.Module, otherModule: ohq.Module): void;
10
- dispose(): void;
17
+ delete(): void;
11
18
  }[];
12
19
  variables: {
13
- (module: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Variable;
14
- dispose(): void;
20
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
21
+ delete(): void;
15
22
  write(w: Writer): void;
16
23
  }[];
17
- dispose(): void;
24
+ delete(): void;
18
25
  write(w: Writer): void;
19
26
  }[];
20
27
  variables: {
21
- (module: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Variable;
22
- dispose(): void;
28
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
29
+ delete(): void;
23
30
  write(w: Writer): void;
24
31
  }[];
25
- dispose(): void;
32
+ delete(): void;
26
33
  write(w: Writer): void;
27
34
  }>;
28
35
  export declare type CellFunc = Awaited<ReturnType<typeof createCell>>;
29
- declare function createFile(file: ohq.File, baseUrl: string): [
30
- string,
31
- any
32
- ];
33
- export declare type FileFunc = ReturnType<typeof createFile>;
34
- export declare function compile(notebook: ohq.Notebook, baseUrl?: string): Promise<{
35
- (runtime: ohq.Runtime, inspector?: ohq.InspectorFactory): ohq.Module;
36
+ export interface CompileOptions {
37
+ baseUrl?: string;
38
+ importMode?: "recursive" | "precompiled";
39
+ }
40
+ export declare function notebook(_files?: ohq.File[], _cells?: CellFunc[], { baseUrl, importMode }?: CompileOptions): {
41
+ (runtime: ohq.Runtime, inspector?: InspectorFactoryEx): ohq.Module;
36
42
  fileAttachments: Map<string, any>;
37
- cells: Map<string, {
38
- (runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): void;
39
- id: string;
43
+ cells: Map<string | number, {
44
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): void;
45
+ id: string | number;
40
46
  modules: {
41
- (runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Module;
47
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): ohq.Module;
42
48
  importVariables: {
43
49
  (main: ohq.Module, otherModule: ohq.Module): void;
44
- dispose(): void;
50
+ delete(): void;
45
51
  }[];
46
52
  variables: {
47
- (module: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Variable;
48
- dispose(): void;
53
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
54
+ delete(): void;
49
55
  write(w: Writer): void;
50
56
  }[];
51
- dispose(): void;
57
+ delete(): void;
52
58
  write(w: Writer): void;
53
59
  }[];
54
60
  variables: {
55
- (module: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Variable;
56
- dispose(): void;
61
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
62
+ delete(): void;
57
63
  write(w: Writer): void;
58
64
  }[];
59
- dispose(): void;
65
+ delete(): void;
60
66
  write(w: Writer): void;
61
67
  }>;
62
- appendCell(n: ohq.Node, baseUrl: any): Promise<{
63
- (runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): void;
64
- id: string;
68
+ set(n: ohq.Node): Promise<CellFunc>;
69
+ get(id: string | number): CellFunc;
70
+ delete(id: string | number): boolean;
71
+ clear(): void;
72
+ write(w: Writer): void;
73
+ toString(w?: Writer): string;
74
+ };
75
+ export declare function compile(notebookOrOjs: ohq.Notebook | string, { baseUrl, importMode }?: CompileOptions): Promise<{
76
+ (runtime: ohq.Runtime, inspector?: InspectorFactoryEx): ohq.Module;
77
+ fileAttachments: Map<string, any>;
78
+ cells: Map<string | number, {
79
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): void;
80
+ id: string | number;
81
+ modules: {
82
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): ohq.Module;
83
+ importVariables: {
84
+ (main: ohq.Module, otherModule: ohq.Module): void;
85
+ delete(): void;
86
+ }[];
87
+ variables: {
88
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
89
+ delete(): void;
90
+ write(w: Writer): void;
91
+ }[];
92
+ delete(): void;
93
+ write(w: Writer): void;
94
+ }[];
95
+ variables: {
96
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
97
+ delete(): void;
98
+ write(w: Writer): void;
99
+ }[];
100
+ delete(): void;
101
+ write(w: Writer): void;
102
+ }>;
103
+ set(n: ohq.Node): Promise<{
104
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): void;
105
+ id: string | number;
65
106
  modules: {
66
- (runtime: ohq.Runtime, main: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Module;
107
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): ohq.Module;
67
108
  importVariables: {
68
109
  (main: ohq.Module, otherModule: ohq.Module): void;
69
- dispose(): void;
110
+ delete(): void;
70
111
  }[];
71
112
  variables: {
72
- (module: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Variable;
73
- dispose(): void;
113
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
114
+ delete(): void;
74
115
  write(w: Writer): void;
75
116
  }[];
76
- dispose(): void;
117
+ delete(): void;
77
118
  write(w: Writer): void;
78
119
  }[];
79
120
  variables: {
80
- (module: ohq.Module, inspector?: ohq.InspectorFactory): ohq.Variable;
81
- dispose(): void;
121
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
122
+ delete(): void;
82
123
  write(w: Writer): void;
83
124
  }[];
84
- dispose(): void;
125
+ delete(): void;
85
126
  write(w: Writer): void;
86
127
  }>;
87
- disposeCell(id: string): Promise<void>;
88
- dispose(): void;
128
+ get(id: string | number): {
129
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): void;
130
+ id: string | number;
131
+ modules: {
132
+ (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): ohq.Module;
133
+ importVariables: {
134
+ (main: ohq.Module, otherModule: ohq.Module): void;
135
+ delete(): void;
136
+ }[];
137
+ variables: {
138
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
139
+ delete(): void;
140
+ write(w: Writer): void;
141
+ }[];
142
+ delete(): void;
143
+ write(w: Writer): void;
144
+ }[];
145
+ variables: {
146
+ (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
147
+ delete(): void;
148
+ write(w: Writer): void;
149
+ }[];
150
+ delete(): void;
151
+ write(w: Writer): void;
152
+ };
153
+ delete(id: string | number): boolean;
154
+ clear(): void;
89
155
  write(w: Writer): void;
90
156
  toString(w?: Writer): string;
91
157
  }>;
@@ -37,6 +37,6 @@ interface ParsedVariableCell extends ParsedCell {
37
37
  inputs: string[];
38
38
  func: any;
39
39
  }
40
- export declare function parseCell(cellStr: string): ParsedImportCell | ParsedViewCell | ParsedMutableCell | ParsedVariableCell;
40
+ export declare function parseCell(cellStr: string, baseUrl: string): ParsedImportCell | ParsedViewCell | ParsedMutableCell | ParsedVariableCell;
41
41
  export {};
42
42
  //# sourceMappingURL=cst.d.ts.map
@@ -1,5 +1,5 @@
1
1
  export { ohq } from "@hpcc-js/observable-shim";
2
2
  export * from "./compiler";
3
- export { ojs2notebook, omd2notebook, parseOmd, download } from "./util";
3
+ export { ojs2notebook, omd2notebook, download } from "./util";
4
4
  import "../src/index.css";
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -10,6 +10,8 @@ export interface Refs {
10
10
  patches: Ref[];
11
11
  }
12
12
  export declare function createFunction(refs: Refs, async?: boolean, generator?: boolean, blockStatement?: boolean, body?: string): any;
13
+ export declare const isRelativePath: (path: string) => boolean;
14
+ export declare const fixRelativeUrl: (path: string, basePath: string) => any;
13
15
  export declare function obfuscatedImport(url: string): Promise<any>;
14
16
  interface ParsedOJS {
15
17
  ojs: string;
@@ -19,7 +21,6 @@ interface ParsedOJS {
19
21
  error: any;
20
22
  }
21
23
  export declare function encodeBacktick(str: string): string;
22
- export declare function parseOmd(_: string): ParsedOJS[];
23
24
  export declare function notebook2ojs(_: string): ParsedOJS[];
24
25
  export declare function ojs2notebook(ojs: string): ohq.Notebook;
25
26
  export declare function omd2notebook(omd: string): ohq.Notebook;