Skip to content

Commit bbc8947

Browse files
committed
update bundler to trim error that confuses eslint
1 parent c6235ef commit bbc8947

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

tools/bundle-bug-finder/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## bundle bug finder
22

3-
This is a hack^Wtool to find badly-generated `deno bundle` code.
3+
This is a tool to find badly-generated bundled code.
44

55
- run `npm install` in this directory
66
- copy the bundled file you generated with `./quarto-bld prepare-dist` to this directory.

tools/bundle-bug-finder/_prelude.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,10 @@
1515
/*global define, module */
1616

1717
/*eslint no-undef: "error"*/
18+
19+
/* puppeteer globals
20+
45454:11 error Definition for rule '@typescript-eslint/ban-ts-comment' was not found @typescript-eslint/ban-ts-comment*/
21+
22+
/*global NodeFilter, ShadowRoot, Node, IntersectionObserver, Event, DataTransfer, XPathResult, base64Decode */
23+
/*global XMLSerializer, predicateQueryHandler, checkWaitForOptions, MutationObserver, requestAnimationFrame, FileReader */
24+
/*global name, createIterResult, navigator */

tools/deno-esbuild-bundle.ts

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,41 @@ import * as esbuild from "npm:[email protected]";
44
// import * as esbuild from "https://deno.land/x/[email protected]/wasm.js";
55

66
import { denoPlugins } from "jsr:@luca/esbuild-deno-loader@^0.11.1";
7-
7+
import { assert } from "https://deno.land/[email protected]/testing/asserts.ts";
88

99
const importMapURL = `file://${Deno.cwd()}/import_map.json`;
1010
// console.log("importMapURL", importMapURL);
1111

1212
await esbuild.build({
13-
plugins: [...denoPlugins({ importMapURL })],
13+
plugins: [...denoPlugins({ importMapURL })
14+
// I wish I could do it this way, but it doesn't work; either
15+
// the plugin is called with an unresolved name before import map,
16+
// or the plugin isn't called at all..
17+
// , {
18+
// "name": "quarto-build-remove-eslint-disable-next-line",
19+
// setup(build: any) {
20+
// build.onLoad({ filter: /DOMWorld\.js/ }, async (args: any) => {
21+
// console.log("HERE!!?!?!");
22+
// const contents = await Deno.readTextFile(args.path);
23+
// assert(contents.indexOf("eslint-disable-next-line") !== -1);
24+
// const newContents = contents.replace("eslint-disable-next-line", "");
25+
// return {
26+
// contents: newContents,
27+
// loader: "js",
28+
// };
29+
// });
30+
// }
31+
// }
32+
],
1433
entryPoints: ["./quarto.ts"],
1534
outfile: "../package/pkg-working/bin/quarto.js",
1635
bundle: true,
1736
format: "esm",
1837
});
38+
esbuild.stop();
39+
// extremely gross to have to do it this way, but apparently esbuild
40+
// plugins don't compose nicely (or at least the deno plugin doesn't)
1941

20-
esbuild.stop();
42+
let out = Deno.readTextFileSync("../package/pkg-working/bin/quarto.js");
43+
out = out.replace("eslint-disable-next-line", "");
44+
Deno.writeTextFileSync("../package/pkg-working/bin/quarto.js", out);

0 commit comments

Comments
 (0)