44// import * as esbuild from "https://deno.land/x/[email protected] /wasm.js"; 55
66import { denoPlugins } from "jsr:@luca/esbuild-deno-loader@^0.11.1" ;
7-
7+ import { assert } from "https://deno.land/[email protected] /testing/asserts.ts" ; 88
99const importMapURL = `file://${ Deno . cwd ( ) } /import_map.json` ;
1010// console.log("importMapURL", importMapURL);
1111
1212await 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