@hpcc-js/observablehq-compiler 1.5.0 → 1.5.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.
package/LICENSE CHANGED
@@ -1,43 +1,43 @@
1
- HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
14
-
15
-
16
- Intersection Algorithms Provided by Kevin Lindsey
17
- Copyright (c) 2000-2011, Kevin Lindsey
18
- All rights reserved.
19
-
20
- Redistribution and use in source and binary forms, with or without
21
- modification, are permitted provided that the following conditions are met:
22
-
23
- - Redistributions of source code must retain the above copyright notice,
24
- this list of conditions and the following disclaimer.
25
-
26
- - Redistributions in binary form must reproduce the above copyright
27
- notice, this list of conditions and the following disclaimer in the
28
- documentation and/or other materials provided with the distribution.
29
-
30
- - Neither the name of this software nor the names of its contributors
31
- may be used to endorse or promote products derived from this software
32
- without specific prior written permission.
33
-
34
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
35
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
36
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
37
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
38
- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
39
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
40
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
41
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
42
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
43
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1
+ HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+
15
+
16
+ Intersection Algorithms Provided by Kevin Lindsey
17
+ Copyright (c) 2000-2011, Kevin Lindsey
18
+ All rights reserved.
19
+
20
+ Redistribution and use in source and binary forms, with or without
21
+ modification, are permitted provided that the following conditions are met:
22
+
23
+ - Redistributions of source code must retain the above copyright notice,
24
+ this list of conditions and the following disclaimer.
25
+
26
+ - Redistributions in binary form must reproduce the above copyright
27
+ notice, this list of conditions and the following disclaimer in the
28
+ documentation and/or other materials provided with the distribution.
29
+
30
+ - Neither the name of this software nor the names of its contributors
31
+ may be used to endorse or promote products derived from this software
32
+ without specific prior written permission.
33
+
34
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
35
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
36
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
37
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
38
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
39
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
40
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
41
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
42
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
43
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,106 +1,106 @@
1
- # @hpcc-js/observablehq-compiler
2
-
3
- An unofficial compiler, interpreter and download tool for [Observable HQ](https://observablehq.com/) notebooks.
4
-
5
- * [Quick Start](#quick-start)
6
- * [Compiler](./src/compiler)
7
- * [Utilities](./src/util)
8
-
9
- ## Quick Start
10
-
11
- This library contains a command line tool (`ojscc`) for downloading and compiling notebooks and an interpreter for rendering notebooks in the browser:
12
- * [Command line interface](#command-line-interface)
13
- * [JS Interpreter](#js-interpreter)
14
-
15
- ## Command line interface
16
-
17
- To call `ojscc` without installing:
18
-
19
- ```sh
20
- npx -p @hpcc-js/observablehq-compiler ojscc [download | compile] ...
21
- ```
22
-
23
- To install `ojscc` as a global command:
24
- ```sh
25
- npm install --global @hpcc-js/observablehq-compiler
26
- ```
27
-
28
- Then it can be called by:
29
- ```sh
30
- ojscc [download | compile] ...
31
- ```
32
-
33
- ### Usage:
34
-
35
- General:
36
- ```sh
37
- ojscc [command]
38
-
39
- Commands:
40
- ojscc download Download ObservableHQ Notebook
41
- ojscc compile Compile ObservableHQ Notebook
42
-
43
- Options:
44
- --version Show version number [boolean]
45
- -h, --help Show help [boolean]
46
- ```
47
-
48
- Download:
49
- ```sh
50
- ojscc download [-o myfile.ojsnb] https://observablehq.com/@user/notebook
51
-
52
- Options:
53
- --version Show version number [boolean]
54
- -h, --help Show help [boolean]
55
- -o, --output Optional output file path
56
- ```
57
-
58
- Compile:
59
- ```sh
60
- ojscc compile [-o myfile.js] myfile.ojsnb
61
-
62
- Options:
63
- --version Show version number [boolean]
64
- -h, --help Show help [boolean]
65
- -o, --output Optional output file path
66
- ```
67
-
68
- ## JS Interpreter
69
-
70
- To install with npm :
71
- ```
72
- npm install --save @hpcc-js/observablehq-compiler
73
- ```
74
-
75
- The interpreter is 100% compatible with:
76
- * [ObservableHQ Runtime](https://github.com/observablehq/runtime)
77
- * [ObservableHQ Inspector](https://github.com/observablehq/inspector)
78
- * [ObservableHQ Library](https://github.com/observablehq/library)
79
-
80
- It also supports fetching notebooks directly from the ObservableHQ repository.
81
-
82
- ```js
83
- import { Library, Runtime, Inspector } from "@observablehq/runtime";
84
- import { download, compile } from "@hpcc-js/observablehq-compiler";
85
-
86
- const placeholder = document.getElementById("placeholder");
87
-
88
- const ohqnb = await download("https://observablehq.com/@observablehq/summary-table");
89
- const compiledNB = await compile(ohqnb);
90
-
91
- const library = new Library();
92
- const runtime = new Runtime(library);
93
- compiledNB(runtime, name => {
94
- const div = document.createElement("div");
95
- placeholder.appendChild(div);
96
- return new Inspector(div);
97
- });
98
- ```
99
-
100
- Which produces (screenshot):
101
-
102
- ---
103
-
104
- ![Sumary Table](./resources/summary-table.png)
105
-
1
+ # @hpcc-js/observablehq-compiler
2
+
3
+ An unofficial compiler, interpreter and download tool for [Observable HQ](https://observablehq.com/) notebooks.
4
+
5
+ * [Quick Start](#quick-start)
6
+ * [Compiler](./src/compiler)
7
+ * [Utilities](./src/util)
8
+
9
+ ## Quick Start
10
+
11
+ This library contains a command line tool (`ojscc`) for downloading and compiling notebooks and an interpreter for rendering notebooks in the browser:
12
+ * [Command line interface](#command-line-interface)
13
+ * [JS Interpreter](#js-interpreter)
14
+
15
+ ## Command line interface
16
+
17
+ To call `ojscc` without installing:
18
+
19
+ ```sh
20
+ npx -p @hpcc-js/observablehq-compiler ojscc [download | compile] ...
21
+ ```
22
+
23
+ To install `ojscc` as a global command:
24
+ ```sh
25
+ npm install --global @hpcc-js/observablehq-compiler
26
+ ```
27
+
28
+ Then it can be called by:
29
+ ```sh
30
+ ojscc [download | compile] ...
31
+ ```
32
+
33
+ ### Usage:
34
+
35
+ General:
36
+ ```sh
37
+ ojscc [command]
38
+
39
+ Commands:
40
+ ojscc download Download ObservableHQ Notebook
41
+ ojscc compile Compile ObservableHQ Notebook
42
+
43
+ Options:
44
+ --version Show version number [boolean]
45
+ -h, --help Show help [boolean]
46
+ ```
47
+
48
+ Download:
49
+ ```sh
50
+ ojscc download [-o myfile.ojsnb] https://observablehq.com/@user/notebook
51
+
52
+ Options:
53
+ --version Show version number [boolean]
54
+ -h, --help Show help [boolean]
55
+ -o, --output Optional output file path
56
+ ```
57
+
58
+ Compile:
59
+ ```sh
60
+ ojscc compile [-o myfile.js] myfile.ojsnb
61
+
62
+ Options:
63
+ --version Show version number [boolean]
64
+ -h, --help Show help [boolean]
65
+ -o, --output Optional output file path
66
+ ```
67
+
68
+ ## JS Interpreter
69
+
70
+ To install with npm :
71
+ ```
72
+ npm install --save @hpcc-js/observablehq-compiler
73
+ ```
74
+
75
+ The interpreter is 100% compatible with:
76
+ * [ObservableHQ Runtime](https://github.com/observablehq/runtime)
77
+ * [ObservableHQ Inspector](https://github.com/observablehq/inspector)
78
+ * [ObservableHQ Library](https://github.com/observablehq/library)
79
+
80
+ It also supports fetching notebooks directly from the ObservableHQ repository.
81
+
82
+ ```js
83
+ import { Library, Runtime, Inspector } from "@observablehq/runtime";
84
+ import { download, compile } from "@hpcc-js/observablehq-compiler";
85
+
86
+ const placeholder = document.getElementById("placeholder");
87
+
88
+ const ohqnb = await download("https://observablehq.com/@observablehq/summary-table");
89
+ const compiledNB = await compile(ohqnb);
90
+
91
+ const library = new Library();
92
+ const runtime = new Runtime(library);
93
+ compiledNB(runtime, name => {
94
+ const div = document.createElement("div");
95
+ placeholder.appendChild(div);
96
+ return new Inspector(div);
97
+ });
98
+ ```
99
+
100
+ Which produces (screenshot):
101
+
102
+ ---
103
+
104
+ ![Sumary Table](./resources/summary-table.png)
105
+
106
106
  ---
package/bin/ojscc.mjs CHANGED
@@ -1,74 +1,74 @@
1
1
  #!/usr/bin/env node
2
- /* eslint-disable no-undef */
3
- /* eslint-disable @typescript-eslint/no-var-requires */
4
-
5
- import fetch, { Blob, blobFrom, blobFromSync, File, fileFrom, fileFromSync, FormData, Headers, Request, Response } from "node-fetch";
6
- if (!globalThis.fetch) {
7
- globalThis.fetch = fetch;
8
- globalThis.Headers = Headers;
9
- globalThis.Request = Request;
10
- globalThis.Response = Response;
11
- }
12
- import { promises as fs } from "fs";
13
- import { compile, download } from "../dist/index.js";
14
- import yargsMode from "yargs/yargs";
15
-
16
- async function doDownload(url, filePath) {
17
- const nb = await download(url);
18
- if (filePath) {
19
- fs.writeFile(filePath, JSON.stringify(nb, undefined, 4));
20
- } else {
21
- console.info(nb);
22
- }
23
- }
24
-
25
- async function doCompile(url, filePath) {
26
- const nb = await download(url);
27
- const define = await compile(nb, process.cwd());
28
- const js = define.toString();
29
- if (filePath) {
30
- fs.writeFile(filePath, js);
31
- } else {
32
- console.info(js);
33
- }
34
- }
35
-
36
- const yargs = yargsMode(process.argv.slice(2));
37
- yargs
38
- .scriptName("ojscc")
39
- .wrap(Math.min(90, yargs.terminalWidth()))
40
- .command("download", "Download ObservableHQ Notebook",
41
- function (yargs) {
42
- return yargs
43
- .usage("ojscc download [-o myfile.ojsnb] https://observablehq.com/@user/notebook")
44
- .demandCommand(1, "URL required")
45
- .option("o", {
46
- alias: "output",
47
- describe: "Optional output file path"
48
- })
49
- ;
50
- }, function (argv) {
51
- doDownload(argv._[1], argv.o);
52
- }
53
- )
54
- .command("compile", "Compile ObservableHQ Notebook",
55
- function (yargs) {
56
- return yargs
57
- .usage("ojscc compile [-o myfile.js] myfile.ojsnb")
58
- .demandCommand(1, "URL required")
59
- .option("o", {
60
- alias: "output",
61
- describe: "Optional output file path"
62
- })
63
- ;
64
- },
65
- async function (argv) {
66
- doCompile(argv._[1], argv.o);
67
- }
68
- )
69
- .help("h")
70
- .alias("h", "help")
71
- .epilog("https://github.com/hpcc-systems/Visualization/tree/trunk/packages/observablehq-compiler")
72
- ;
73
-
74
- yargs.argv;
2
+ /* eslint-disable no-undef */
3
+ /* eslint-disable @typescript-eslint/no-var-requires */
4
+
5
+ import fetch, { Blob, blobFrom, blobFromSync, File, fileFrom, fileFromSync, FormData, Headers, Request, Response } from "node-fetch";
6
+ if (!globalThis.fetch) {
7
+ globalThis.fetch = fetch;
8
+ globalThis.Headers = Headers;
9
+ globalThis.Request = Request;
10
+ globalThis.Response = Response;
11
+ }
12
+ import { promises as fs } from "fs";
13
+ import { compile, download } from "../dist/index.js";
14
+ import yargsMode from "yargs/yargs";
15
+
16
+ async function doDownload(url, filePath) {
17
+ const nb = await download(url);
18
+ if (filePath) {
19
+ fs.writeFile(filePath, JSON.stringify(nb, undefined, 4));
20
+ } else {
21
+ console.info(nb);
22
+ }
23
+ }
24
+
25
+ async function doCompile(url, filePath) {
26
+ const nb = await download(url);
27
+ const define = await compile(nb, process.cwd());
28
+ const js = define.toString();
29
+ if (filePath) {
30
+ fs.writeFile(filePath, js);
31
+ } else {
32
+ console.info(js);
33
+ }
34
+ }
35
+
36
+ const yargs = yargsMode(process.argv.slice(2));
37
+ yargs
38
+ .scriptName("ojscc")
39
+ .wrap(Math.min(90, yargs.terminalWidth()))
40
+ .command("download", "Download ObservableHQ Notebook",
41
+ function (yargs) {
42
+ return yargs
43
+ .usage("ojscc download [-o myfile.ojsnb] https://observablehq.com/@user/notebook")
44
+ .demandCommand(1, "URL required")
45
+ .option("o", {
46
+ alias: "output",
47
+ describe: "Optional output file path"
48
+ })
49
+ ;
50
+ }, function (argv) {
51
+ doDownload(argv._[1], argv.o);
52
+ }
53
+ )
54
+ .command("compile", "Compile ObservableHQ Notebook",
55
+ function (yargs) {
56
+ return yargs
57
+ .usage("ojscc compile [-o myfile.js] myfile.ojsnb")
58
+ .demandCommand(1, "URL required")
59
+ .option("o", {
60
+ alias: "output",
61
+ describe: "Optional output file path"
62
+ })
63
+ ;
64
+ },
65
+ async function (argv) {
66
+ doCompile(argv._[1], argv.o);
67
+ }
68
+ )
69
+ .help("h")
70
+ .alias("h", "help")
71
+ .epilog("https://github.com/hpcc-systems/Visualization/tree/trunk/packages/observablehq-compiler")
72
+ ;
73
+
74
+ yargs.argv;
package/dist/index.esm.js CHANGED
@@ -821,10 +821,10 @@ var pp$8 = Parser.prototype;
821
821
  // to its body instead of creating a new node.
822
822
 
823
823
  pp$8.parseTopLevel = function(node) {
824
- var exports = Object.create(null);
824
+ var exports$1 = Object.create(null);
825
825
  if (!node.body) { node.body = []; }
826
826
  while (this.type !== types$1.eof) {
827
- var stmt = this.parseStatement(null, true, exports);
827
+ var stmt = this.parseStatement(null, true, exports$1);
828
828
  node.body.push(stmt);
829
829
  }
830
830
  if (this.inModule)
@@ -931,7 +931,7 @@ pp$8.isUsing = function(isFor) {
931
931
  // `if (foo) /blah/.exec(foo)`, where looking at the previous token
932
932
  // does not help.
933
933
 
934
- pp$8.parseStatement = function(context, topLevel, exports) {
934
+ pp$8.parseStatement = function(context, topLevel, exports$1) {
935
935
  var starttype = this.type, node = this.startNode(), kind;
936
936
 
937
937
  if (this.isLet(context)) {
@@ -986,7 +986,7 @@ pp$8.parseStatement = function(context, topLevel, exports) {
986
986
  if (!this.inModule)
987
987
  { this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
988
988
  }
989
- return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
989
+ return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports$1)
990
990
 
991
991
  // If the statement does not start with a statement keyword or a
992
992
  // brace, it's an ExpressionStatement or LabeledStatement. We
@@ -1742,11 +1742,11 @@ function checkKeyName(node, name) {
1742
1742
 
1743
1743
  // Parses module export declaration.
1744
1744
 
1745
- pp$8.parseExportAllDeclaration = function(node, exports) {
1745
+ pp$8.parseExportAllDeclaration = function(node, exports$1) {
1746
1746
  if (this.options.ecmaVersion >= 11) {
1747
1747
  if (this.eatContextual("as")) {
1748
1748
  node.exported = this.parseModuleExportName();
1749
- this.checkExport(exports, node.exported, this.lastTokStart);
1749
+ this.checkExport(exports$1, node.exported, this.lastTokStart);
1750
1750
  } else {
1751
1751
  node.exported = null;
1752
1752
  }
@@ -1760,14 +1760,14 @@ pp$8.parseExportAllDeclaration = function(node, exports) {
1760
1760
  return this.finishNode(node, "ExportAllDeclaration")
1761
1761
  };
1762
1762
 
1763
- pp$8.parseExport = function(node, exports) {
1763
+ pp$8.parseExport = function(node, exports$1) {
1764
1764
  this.next();
1765
1765
  // export * from '...'
1766
1766
  if (this.eat(types$1.star)) {
1767
- return this.parseExportAllDeclaration(node, exports)
1767
+ return this.parseExportAllDeclaration(node, exports$1)
1768
1768
  }
1769
1769
  if (this.eat(types$1._default)) { // export default ...
1770
- this.checkExport(exports, "default", this.lastTokStart);
1770
+ this.checkExport(exports$1, "default", this.lastTokStart);
1771
1771
  node.declaration = this.parseExportDefaultDeclaration();
1772
1772
  return this.finishNode(node, "ExportDefaultDeclaration")
1773
1773
  }
@@ -1775,16 +1775,16 @@ pp$8.parseExport = function(node, exports) {
1775
1775
  if (this.shouldParseExportStatement()) {
1776
1776
  node.declaration = this.parseExportDeclaration(node);
1777
1777
  if (node.declaration.type === "VariableDeclaration")
1778
- { this.checkVariableExport(exports, node.declaration.declarations); }
1778
+ { this.checkVariableExport(exports$1, node.declaration.declarations); }
1779
1779
  else
1780
- { this.checkExport(exports, node.declaration.id, node.declaration.id.start); }
1780
+ { this.checkExport(exports$1, node.declaration.id, node.declaration.id.start); }
1781
1781
  node.specifiers = [];
1782
1782
  node.source = null;
1783
1783
  if (this.options.ecmaVersion >= 16)
1784
1784
  { node.attributes = []; }
1785
1785
  } else { // export { x, y as z } [from '...']
1786
1786
  node.declaration = null;
1787
- node.specifiers = this.parseExportSpecifiers(exports);
1787
+ node.specifiers = this.parseExportSpecifiers(exports$1);
1788
1788
  if (this.eatContextual("from")) {
1789
1789
  if (this.type !== types$1.string) { this.unexpected(); }
1790
1790
  node.source = this.parseExprAtom();
@@ -1834,47 +1834,47 @@ pp$8.parseExportDefaultDeclaration = function() {
1834
1834
  }
1835
1835
  };
1836
1836
 
1837
- pp$8.checkExport = function(exports, name, pos) {
1838
- if (!exports) { return }
1837
+ pp$8.checkExport = function(exports$1, name, pos) {
1838
+ if (!exports$1) { return }
1839
1839
  if (typeof name !== "string")
1840
1840
  { name = name.type === "Identifier" ? name.name : name.value; }
1841
- if (hasOwn(exports, name))
1841
+ if (hasOwn(exports$1, name))
1842
1842
  { this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
1843
- exports[name] = true;
1843
+ exports$1[name] = true;
1844
1844
  };
1845
1845
 
1846
- pp$8.checkPatternExport = function(exports, pat) {
1846
+ pp$8.checkPatternExport = function(exports$1, pat) {
1847
1847
  var type = pat.type;
1848
1848
  if (type === "Identifier")
1849
- { this.checkExport(exports, pat, pat.start); }
1849
+ { this.checkExport(exports$1, pat, pat.start); }
1850
1850
  else if (type === "ObjectPattern")
1851
1851
  { for (var i = 0, list = pat.properties; i < list.length; i += 1)
1852
1852
  {
1853
1853
  var prop = list[i];
1854
1854
 
1855
- this.checkPatternExport(exports, prop);
1855
+ this.checkPatternExport(exports$1, prop);
1856
1856
  } }
1857
1857
  else if (type === "ArrayPattern")
1858
1858
  { for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
1859
1859
  var elt = list$1[i$1];
1860
1860
 
1861
- if (elt) { this.checkPatternExport(exports, elt); }
1861
+ if (elt) { this.checkPatternExport(exports$1, elt); }
1862
1862
  } }
1863
1863
  else if (type === "Property")
1864
- { this.checkPatternExport(exports, pat.value); }
1864
+ { this.checkPatternExport(exports$1, pat.value); }
1865
1865
  else if (type === "AssignmentPattern")
1866
- { this.checkPatternExport(exports, pat.left); }
1866
+ { this.checkPatternExport(exports$1, pat.left); }
1867
1867
  else if (type === "RestElement")
1868
- { this.checkPatternExport(exports, pat.argument); }
1868
+ { this.checkPatternExport(exports$1, pat.argument); }
1869
1869
  };
1870
1870
 
1871
- pp$8.checkVariableExport = function(exports, decls) {
1872
- if (!exports) { return }
1871
+ pp$8.checkVariableExport = function(exports$1, decls) {
1872
+ if (!exports$1) { return }
1873
1873
  for (var i = 0, list = decls; i < list.length; i += 1)
1874
1874
  {
1875
1875
  var decl = list[i];
1876
1876
 
1877
- this.checkPatternExport(exports, decl.id);
1877
+ this.checkPatternExport(exports$1, decl.id);
1878
1878
  }
1879
1879
  };
1880
1880
 
@@ -1889,13 +1889,13 @@ pp$8.shouldParseExportStatement = function() {
1889
1889
 
1890
1890
  // Parses a comma-separated list of module exports.
1891
1891
 
1892
- pp$8.parseExportSpecifier = function(exports) {
1892
+ pp$8.parseExportSpecifier = function(exports$1) {
1893
1893
  var node = this.startNode();
1894
1894
  node.local = this.parseModuleExportName();
1895
1895
 
1896
1896
  node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
1897
1897
  this.checkExport(
1898
- exports,
1898
+ exports$1,
1899
1899
  node.exported,
1900
1900
  node.exported.start
1901
1901
  );
@@ -1903,7 +1903,7 @@ pp$8.parseExportSpecifier = function(exports) {
1903
1903
  return this.finishNode(node, "ExportSpecifier")
1904
1904
  };
1905
1905
 
1906
- pp$8.parseExportSpecifiers = function(exports) {
1906
+ pp$8.parseExportSpecifiers = function(exports$1) {
1907
1907
  var nodes = [], first = true;
1908
1908
  // export { x, y as z } [from '...']
1909
1909
  this.expect(types$1.braceL);
@@ -1913,7 +1913,7 @@ pp$8.parseExportSpecifiers = function(exports) {
1913
1913
  if (this.afterTrailingComma(types$1.braceR)) { break }
1914
1914
  } else { first = false; }
1915
1915
 
1916
- nodes.push(this.parseExportSpecifier(exports));
1916
+ nodes.push(this.parseExportSpecifier(exports$1));
1917
1917
  }
1918
1918
  return nodes
1919
1919
  };
@@ -7863,23 +7863,23 @@ class Writer {
7863
7863
  this._functionUid = 0;
7864
7864
  }
7865
7865
  toString() {
7866
- return `\
7867
- ${this._imports.join("\n")}
7868
-
7869
- ${this._functions.join("\n").split("\n) {").join("){")}
7870
-
7871
- export default function define(runtime, observer) {
7872
- const main = runtime.module();
7873
-
7874
- function toString() { return this.url; }
7875
- const fileAttachments = new Map([
7876
- ${this._files.map(f => `["${f.name}", { url: new URL("${f.url}"), mimeType: ${JSON.stringify(f.mime_type)}, toString }]`).join(",\n ")}
7877
- ]);
7878
- main.builtin("FileAttachment", runtime.fileAttachments(name => fileAttachments.get(name)));
7879
-
7880
- ${this._defines.join("\n ")}
7881
-
7882
- return main;
7866
+ return `\
7867
+ ${this._imports.join("\n")}
7868
+
7869
+ ${this._functions.join("\n").split("\n) {").join("){")}
7870
+
7871
+ export default function define(runtime, observer) {
7872
+ const main = runtime.module();
7873
+
7874
+ function toString() { return this.url; }
7875
+ const fileAttachments = new Map([
7876
+ ${this._files.map(f => `["${f.name}", { url: new URL("${f.url}"), mimeType: ${JSON.stringify(f.mime_type)}, toString }]`).join(",\n ")}
7877
+ ]);
7878
+ main.builtin("FileAttachment", runtime.fileAttachments(name => fileAttachments.get(name)));
7879
+
7880
+ ${this._defines.join("\n ")}
7881
+
7882
+ return main;
7883
7883
  }\n`;
7884
7884
  }
7885
7885
  files(files) {
@@ -8036,8 +8036,8 @@ function createVariable(node, inspect, name, inputs, definition, inline = false)
8036
8036
  v = module.variable(inspector(name, node.id));
8037
8037
  try {
8038
8038
  v.define(undefined, ["md"], md => {
8039
- return md `\`\`\`js
8040
- ${node.value}
8039
+ return md `\`\`\`js
8040
+ ${node.value}
8041
8041
  \`\`\``;
8042
8042
  });
8043
8043
  }