feat: support embedded import map in deno.json (#1188)

One can now inline the `imports` and `scopes` from the import map directly into deno.json.

For new projects, `import_map.json` is not generated anymore.

Co-authored-by: Luca Casonato <hello@lcas.dev>
This commit is contained in:
Asher Gomez
2023-06-03 10:46:40 +02:00
committed by GitHub
co-authored by Luca Casonato
parent 3857a49f1c
commit 1b6678951a
34 changed files with 149 additions and 197 deletions
+3 -3
View File
@@ -2,8 +2,8 @@
export {
fromFileUrl,
toFileUrl,
} from "https://deno.land/std@0.189.0/path/mod.ts";
export { escape as regexpEscape } from "https://deno.land/std@0.189.0/regexp/escape.ts";
} from "https://deno.land/std@0.190.0/path/mod.ts";
export { escape as regexpEscape } from "https://deno.land/std@0.190.0/regexp/escape.ts";
// -- esbuild --
// @deno-types="https://deno.land/x/esbuild@v0.17.11/mod.d.ts"
@@ -17,4 +17,4 @@ const esbuild: typeof esbuildWasm = Deno.run === undefined
const esbuildWasmURL = new URL("./esbuild_v0.17.11.wasm", import.meta.url).href;
export { esbuild, esbuildWasm as esbuildTypes, esbuildWasmURL };
export { denoPlugins } from "https://deno.land/x/esbuild_deno_loader@0.7.0/mod.ts";
export { denoPlugins } from "https://deno.land/x/esbuild_deno_loader@0.7.2/mod.ts";
+3 -3
View File
@@ -16,8 +16,8 @@ export interface EsbuildBuilderOptions {
entrypoints: Record<string, string>;
/** Whether or not this is a dev build. */
dev: boolean;
/** The import map URL. */
importMapURL: URL;
/** The path to the deno.json / deno.jsonc config file. */
configPath: string;
/** The JSX configuration. */
jsxConfig: JSXConfig;
}
@@ -74,7 +74,7 @@ export class EsbuildBuilder implements Builder {
plugins: [
buildIdPlugin(opts.buildID),
...denoPlugins({ importMapURL: opts.importMapURL.href }),
...denoPlugins({ configPath: opts.configPath }),
],
});