@hpcc-js/observablehq-compiler 1.3.0 → 3.1.0

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.
Files changed (58) hide show
  1. package/bin/ojscc.mjs +13 -19
  2. package/dist/index.css +2 -1
  3. package/dist/index.css.map +7 -0
  4. package/dist/index.js +24 -8011
  5. package/dist/index.js.map +7 -1
  6. package/package.json +39 -50
  7. package/src/__package__.ts +2 -2
  8. package/src/compiler.ts +33 -21
  9. package/src/cst.ts +27 -23
  10. package/src/index.ts +3 -2
  11. package/src/util.ts +4 -1
  12. package/src/writer.ts +8 -5
  13. package/types/compiler.d.ts +6 -7
  14. package/types/cst.d.ts +0 -1
  15. package/types/index.d.ts +3 -3
  16. package/types/util.d.ts +1 -2
  17. package/types/writer.d.ts +1 -2
  18. package/dist/index.esm.css +0 -1
  19. package/dist/index.esm.js +0 -8011
  20. package/dist/index.esm.js.map +0 -1
  21. package/dist/index.esm.min.js +0 -4
  22. package/dist/index.esm.min.js.map +0 -1
  23. package/dist/index.min.js +0 -4
  24. package/dist/index.min.js.map +0 -1
  25. package/src/__tests__/File Attachments.ts +0 -895
  26. package/src/__tests__/Introduction to Imports.ts +0 -749
  27. package/src/__tests__/Observable TimeChart.ts +0 -772
  28. package/src/__tests__/index.ts +0 -13
  29. package/src/__tests__/m1.mjs +0 -3
  30. package/src/__tests__/node.ts +0 -199
  31. package/types/__package__.d.ts +0 -4
  32. package/types/__package__.d.ts.map +0 -1
  33. package/types/__tests__/File Attachments.d.ts +0 -110
  34. package/types/__tests__/File Attachments.d.ts.map +0 -1
  35. package/types/__tests__/Introduction to Imports.d.ts +0 -120
  36. package/types/__tests__/Introduction to Imports.d.ts.map +0 -1
  37. package/types/__tests__/Observable TimeChart.d.ts +0 -111
  38. package/types/__tests__/Observable TimeChart.d.ts.map +0 -1
  39. package/types/__tests__/index.d.ts +0 -2
  40. package/types/__tests__/index.d.ts.map +0 -1
  41. package/types/__tests__/node.d.ts +0 -2
  42. package/types/__tests__/node.d.ts.map +0 -1
  43. package/types/compiler.d.ts.map +0 -1
  44. package/types/cst.d.ts.map +0 -1
  45. package/types/index.d.ts.map +0 -1
  46. package/types/util.d.ts.map +0 -1
  47. package/types/writer.d.ts.map +0 -1
  48. package/types-3.4/__package__.d.ts +0 -4
  49. package/types-3.4/__tests__/File Attachments.d.ts +0 -110
  50. package/types-3.4/__tests__/Introduction to Imports.d.ts +0 -120
  51. package/types-3.4/__tests__/Observable TimeChart.d.ts +0 -111
  52. package/types-3.4/__tests__/index.d.ts +0 -2
  53. package/types-3.4/__tests__/node.d.ts +0 -2
  54. package/types-3.4/compiler.d.ts +0 -112
  55. package/types-3.4/cst.d.ts +0 -42
  56. package/types-3.4/index.d.ts +0 -5
  57. package/types-3.4/util.d.ts +0 -30
  58. package/types-3.4/writer.d.ts +0 -19
@@ -1,110 +0,0 @@
1
- export declare const fa: {
2
- id: string;
3
- slug: string;
4
- trashed: boolean;
5
- description: string;
6
- likes: number;
7
- publish_level: string;
8
- forks: number;
9
- fork_of: any;
10
- update_time: string;
11
- publish_time: string;
12
- publish_version: number;
13
- latest_version: number;
14
- thumbnail: string;
15
- default_thumbnail: string;
16
- roles: any[];
17
- sharing: any;
18
- owner: {
19
- id: string;
20
- avatar_url: string;
21
- login: string;
22
- name: string;
23
- bio: string;
24
- home_url: string;
25
- type: string;
26
- tier: string;
27
- };
28
- creator: {
29
- id: string;
30
- github_login: string;
31
- avatar_url: string;
32
- login: string;
33
- name: string;
34
- bio: string;
35
- home_url: string;
36
- tier: string;
37
- };
38
- authors: any[];
39
- collections: {
40
- id: string;
41
- type: string;
42
- slug: string;
43
- title: string;
44
- description: string;
45
- update_time: string;
46
- pinned: boolean;
47
- ordered: boolean;
48
- custom_thumbnail: string;
49
- default_thumbnail: string;
50
- thumbnail: string;
51
- listing_count: number;
52
- parent_collection_count: number;
53
- owner: {
54
- id: string;
55
- avatar_url: string;
56
- login: string;
57
- name: string;
58
- bio: string;
59
- home_url: string;
60
- type: string;
61
- tier: string;
62
- };
63
- }[];
64
- files: {
65
- id: string;
66
- url: string;
67
- download_url: string;
68
- name: string;
69
- create_time: string;
70
- status: string;
71
- size: number;
72
- mime_type: string;
73
- content_encoding: string;
74
- }[];
75
- comments: {
76
- id: string;
77
- content: string;
78
- node_id: number;
79
- create_time: string;
80
- update_time: any;
81
- resolved: boolean;
82
- user: {
83
- id: string;
84
- github_login: string;
85
- avatar_url: string;
86
- login: string;
87
- name: string;
88
- bio: string;
89
- home_url: string;
90
- tier: string;
91
- };
92
- }[];
93
- commenting_lock: any;
94
- suggestion_from: any;
95
- suggestions_to: any[];
96
- version: number;
97
- title: string;
98
- license: any;
99
- copyright: string;
100
- nodes: {
101
- id: number;
102
- value: string;
103
- pinned: boolean;
104
- mode: string;
105
- data: any;
106
- name: string;
107
- }[];
108
- resolutions: any[];
109
- };
110
- //# sourceMappingURL=File%20Attachments.d.ts.map
@@ -1,120 +0,0 @@
1
- export declare const imports: {
2
- id: string;
3
- slug: string;
4
- trashed: boolean;
5
- description: string;
6
- likes: number;
7
- publish_level: string;
8
- forks: number;
9
- fork_of: any;
10
- update_time: string;
11
- publish_time: string;
12
- publish_version: number;
13
- latest_version: number;
14
- thumbnail: string;
15
- default_thumbnail: string;
16
- roles: any[];
17
- sharing: any;
18
- owner: {
19
- id: string;
20
- avatar_url: string;
21
- login: string;
22
- name: string;
23
- bio: string;
24
- home_url: string;
25
- type: string;
26
- tier: string;
27
- };
28
- creator: {
29
- id: string;
30
- github_login: string;
31
- avatar_url: string;
32
- login: string;
33
- name: string;
34
- bio: string;
35
- home_url: string;
36
- tier: string;
37
- };
38
- authors: any[];
39
- collections: {
40
- id: string;
41
- type: string;
42
- slug: string;
43
- title: string;
44
- description: string;
45
- update_time: string;
46
- pinned: boolean;
47
- ordered: boolean;
48
- custom_thumbnail: string;
49
- default_thumbnail: string;
50
- thumbnail: string;
51
- listing_count: number;
52
- parent_collection_count: number;
53
- owner: {
54
- id: string;
55
- avatar_url: string;
56
- login: string;
57
- name: string;
58
- bio: string;
59
- home_url: string;
60
- type: string;
61
- tier: string;
62
- };
63
- }[];
64
- files: ({
65
- id: string;
66
- url: string;
67
- download_url: string;
68
- name: string;
69
- create_time: string;
70
- status: string;
71
- size: number;
72
- mime_type: any;
73
- content_encoding: string;
74
- } | {
75
- id: string;
76
- url: string;
77
- download_url: string;
78
- name: string;
79
- create_time: string;
80
- status: string;
81
- size: number;
82
- mime_type: string;
83
- content_encoding: any;
84
- })[];
85
- comments: {
86
- id: string;
87
- content: string;
88
- node_id: number;
89
- create_time: string;
90
- update_time: any;
91
- resolved: boolean;
92
- user: {
93
- id: string;
94
- github_login: string;
95
- avatar_url: string;
96
- login: string;
97
- name: string;
98
- bio: string;
99
- home_url: string;
100
- tier: string;
101
- };
102
- }[];
103
- commenting_lock: any;
104
- suggestion_from: any;
105
- suggestions_to: any[];
106
- version: number;
107
- title: string;
108
- license: any;
109
- copyright: string;
110
- nodes: {
111
- id: number;
112
- value: string;
113
- pinned: boolean;
114
- mode: string;
115
- data: any;
116
- name: string;
117
- }[];
118
- resolutions: any[];
119
- };
120
- //# sourceMappingURL=Introduction%20to%20Imports.d.ts.map
@@ -1,111 +0,0 @@
1
- export declare const timechart: {
2
- id: string;
3
- slug: string;
4
- trashed: boolean;
5
- description: string;
6
- likes: number;
7
- publish_level: string;
8
- forks: number;
9
- fork_of: any;
10
- update_time: string;
11
- publish_time: string;
12
- publish_version: number;
13
- latest_version: number;
14
- thumbnail: string;
15
- default_thumbnail: string;
16
- roles: any[];
17
- sharing: any;
18
- owner: {
19
- id: string;
20
- avatar_url: string;
21
- login: string;
22
- name: string;
23
- bio: string;
24
- home_url: string;
25
- type: string;
26
- tier: string;
27
- };
28
- creator: {
29
- id: string;
30
- github_login: string;
31
- avatar_url: string;
32
- login: string;
33
- name: string;
34
- bio: string;
35
- home_url: string;
36
- tier: string;
37
- };
38
- authors: {
39
- id: string;
40
- avatar_url: string;
41
- name: string;
42
- login: string;
43
- bio: string;
44
- home_url: string;
45
- github_login: string;
46
- tier: string;
47
- approved: boolean;
48
- description: string;
49
- }[];
50
- collections: {
51
- id: string;
52
- type: string;
53
- slug: string;
54
- title: string;
55
- description: string;
56
- update_time: string;
57
- pinned: boolean;
58
- ordered: boolean;
59
- custom_thumbnail: string;
60
- default_thumbnail: string;
61
- thumbnail: string;
62
- listing_count: number;
63
- parent_collection_count: number;
64
- owner: {
65
- id: string;
66
- avatar_url: string;
67
- login: string;
68
- name: string;
69
- bio: string;
70
- home_url: string;
71
- type: string;
72
- tier: string;
73
- };
74
- }[];
75
- files: any[];
76
- comments: {
77
- id: string;
78
- content: string;
79
- node_id: number;
80
- create_time: string;
81
- update_time: any;
82
- resolved: boolean;
83
- user: {
84
- id: string;
85
- github_login: string;
86
- avatar_url: string;
87
- login: string;
88
- name: string;
89
- bio: string;
90
- home_url: string;
91
- tier: string;
92
- };
93
- }[];
94
- commenting_lock: any;
95
- suggestion_from: any;
96
- suggestions_to: any[];
97
- version: number;
98
- title: string;
99
- license: string;
100
- copyright: string;
101
- nodes: {
102
- id: number;
103
- value: string;
104
- pinned: boolean;
105
- mode: string;
106
- data: any;
107
- name: any;
108
- }[];
109
- resolutions: any[];
110
- };
111
- //# sourceMappingURL=Observable%20TimeChart.d.ts.map
@@ -1,2 +0,0 @@
1
- export * from "./node";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=node.d.ts.map
@@ -1,112 +0,0 @@
1
- import { ohq } from "@hpcc-js/observable-shim";
2
- import { Writer } from "./writer";
3
- export 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;
13
- modules: {
14
- (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): ohq.Module;
15
- importVariables: {
16
- (main: ohq.Module, otherModule: ohq.Module): void;
17
- delete(): void;
18
- }[];
19
- variables: {
20
- (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
21
- delete(): void;
22
- write(w: Writer): void;
23
- }[];
24
- delete(): void;
25
- write(w: Writer): void;
26
- }[];
27
- variables: {
28
- (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
29
- delete(): void;
30
- write(w: Writer): void;
31
- }[];
32
- delete(): void;
33
- write(w: Writer): void;
34
- }>;
35
- export type CellFunc = Awaited<ReturnType<typeof createCell>>;
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;
42
- fileAttachments: Map<string, any>;
43
- cells: Map<string | number, {
44
- (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): void;
45
- id: string | number;
46
- modules: {
47
- (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx): ohq.Module;
48
- importVariables: {
49
- (main: ohq.Module, otherModule: ohq.Module): void;
50
- delete(): void;
51
- }[];
52
- variables: {
53
- (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
54
- delete(): void;
55
- write(w: Writer): void;
56
- }[];
57
- delete(): void;
58
- write(w: Writer): void;
59
- }[];
60
- variables: {
61
- (module: ohq.Module, inspector?: InspectorFactoryEx): ohq.Variable;
62
- delete(): void;
63
- write(w: Writer): void;
64
- }[];
65
- delete(): void;
66
- write(w: Writer): void;
67
- }>;
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<CellFunc>;
104
- get(id: string | number): CellFunc;
105
- delete(id: string | number): boolean;
106
- clear(): void;
107
- write(w: Writer): void;
108
- toString(w?: Writer): string;
109
- }>;
110
- export type compileFunc = Awaited<ReturnType<typeof compile>>;
111
- export {};
112
- //# sourceMappingURL=compiler.d.ts.map
@@ -1,42 +0,0 @@
1
- export interface ParsedCell {
2
- type: "import" | "viewof" | "mutable" | "variable" | "identifier";
3
- }
4
- export interface ParsedImportCell extends ParsedCell {
5
- type: "import";
6
- src: string;
7
- specifiers: {
8
- view: boolean;
9
- name: string;
10
- alias?: string;
11
- }[];
12
- injections: {
13
- name: string;
14
- alias: string;
15
- }[];
16
- }
17
- export interface ParsedVariable extends ParsedCell {
18
- type: "variable";
19
- id?: string;
20
- inputs: string[];
21
- func: any;
22
- }
23
- export interface ParsedViewCell extends ParsedCell {
24
- type: "viewof";
25
- variable: ParsedVariable;
26
- variableValue: ParsedVariable;
27
- }
28
- interface ParsedMutableCell extends ParsedCell {
29
- type: "mutable";
30
- initial: ParsedVariable;
31
- variable: ParsedVariable;
32
- variableValue: ParsedVariable;
33
- }
34
- interface ParsedVariableCell extends ParsedCell {
35
- type: "variable";
36
- id: string;
37
- inputs: string[];
38
- func: any;
39
- }
40
- export declare function parseCell(cellStr: string, baseUrl: string): ParsedImportCell | ParsedViewCell | ParsedMutableCell | ParsedVariableCell;
41
- export {};
42
- //# sourceMappingURL=cst.d.ts.map
@@ -1,5 +0,0 @@
1
- export { ohq } from "@hpcc-js/observable-shim";
2
- export * from "./compiler";
3
- export { ojs2notebook, omd2notebook, download } from "./util";
4
- import "../src/index.css";
5
- //# sourceMappingURL=index.d.ts.map
@@ -1,30 +0,0 @@
1
- import { ohq } from "@hpcc-js/observable-shim";
2
- interface Ref {
3
- start: number;
4
- end: number;
5
- newText: string;
6
- }
7
- export interface Refs {
8
- inputs: string[];
9
- args: string[];
10
- patches: Ref[];
11
- }
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;
15
- export declare function obfuscatedImport(url: string): Promise<any>;
16
- interface ParsedOJS {
17
- ojs: string;
18
- offset: number;
19
- inlineMD: boolean;
20
- cell: any;
21
- error: any;
22
- }
23
- export declare function encodeBacktick(str: string): string;
24
- export declare function notebook2ojs(_: string): ParsedOJS[];
25
- export declare function ojs2notebook(ojs: string): ohq.Notebook;
26
- export declare function omd2notebook(omd: string): ohq.Notebook;
27
- export declare function fetchEx(url: string, proxyPrefix?: string, proxyPostfix?: string): Promise<Response>;
28
- export declare function download(impUrl: string, proxyPrefix?: string, proxyPostfix?: string): Promise<ohq.Notebook>;
29
- export {};
30
- //# sourceMappingURL=util.d.ts.map
@@ -1,19 +0,0 @@
1
- import { ohq } from "@hpcc-js/observable-shim";
2
- import { ParsedImportCell, ParsedVariable } from "./cst";
3
- export declare class Writer {
4
- protected _files: ohq.File[];
5
- protected _imports: string[];
6
- protected _functions: string[];
7
- protected _defines: string[];
8
- protected _defineUid: number;
9
- protected _functionUid: number;
10
- constructor();
11
- toString(): string;
12
- files(files: ohq.File[]): void;
13
- import(url: string): void;
14
- importDefine(imp: Partial<ParsedImportCell>): void;
15
- function(variable: Partial<ParsedVariable>): string;
16
- define(variable: Partial<ParsedVariable>, observable?: boolean, inlineFunc?: boolean, funcId?: string): void;
17
- error(msg: string): void;
18
- }
19
- //# sourceMappingURL=writer.d.ts.map