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:
co-authored by
Luca Casonato
parent
3857a49f1c
commit
1b6678951a
+1
-13
@@ -65,7 +65,6 @@ Deno.test({
|
||||
"name": tmpDirName,
|
||||
"contents": [
|
||||
{ "type": "file", "name": "README.md" },
|
||||
{ "type": "file", "name": "import_map.json" },
|
||||
{ "type": "file", "name": "fresh.gen.ts" },
|
||||
{
|
||||
"type": "directory",
|
||||
@@ -204,7 +203,6 @@ Deno.test({
|
||||
"name": tmpDirName,
|
||||
"contents": [
|
||||
{ "type": "file", "name": "README.md" },
|
||||
{ "type": "file", "name": "import_map.json" },
|
||||
{ "type": "file", "name": "fresh.gen.ts" },
|
||||
{ "type": "file", "name": "twind.config.ts" },
|
||||
{
|
||||
@@ -422,20 +420,11 @@ Deno.test({
|
||||
|
||||
await cliProcess.output();
|
||||
|
||||
// "move deno.json and import_map.json one level up"
|
||||
// move deno.json one level up
|
||||
await Deno.rename(
|
||||
path.join(tmpDirName, "subdirectory", "subsubdirectory", "deno.json"),
|
||||
path.join(tmpDirName, "deno.json"),
|
||||
);
|
||||
await Deno.rename(
|
||||
path.join(
|
||||
tmpDirName,
|
||||
"subdirectory",
|
||||
"subsubdirectory",
|
||||
"import_map.json",
|
||||
),
|
||||
path.join(tmpDirName, "import_map.json"),
|
||||
);
|
||||
|
||||
const targetFileTree: FileTree[] = [
|
||||
{
|
||||
@@ -443,7 +432,6 @@ Deno.test({
|
||||
"name": tmpDirName,
|
||||
"contents": [
|
||||
{ "type": "file", "name": "deno.json" },
|
||||
{ "type": "file", "name": "import_map.json" },
|
||||
{
|
||||
"type": "directory",
|
||||
"name": "subdirectory",
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
{
|
||||
"lock": false,
|
||||
"importMap": "./import_map.json",
|
||||
"imports": {
|
||||
"$fresh/": "../../",
|
||||
"preact": "https://esm.sh/preact@10.15.1",
|
||||
"preact/": "https://esm.sh/preact@10.15.1/",
|
||||
"preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.0.3",
|
||||
"@preact/signals": "https://esm.sh/*@preact/signals@1.1.3",
|
||||
"@preact/signals-core": "https://esm.sh/@preact/signals-core@1.2.3"
|
||||
},
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx",
|
||||
"jsxImportSource": "preact"
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// This file SHOULD be checked into source version control.
|
||||
// This file is automatically updated during development when running `dev.ts`.
|
||||
|
||||
import config from "./deno.json" assert { type: "json" };
|
||||
import * as $0 from "./routes/[name].tsx";
|
||||
import * as $1 from "./routes/_404.tsx";
|
||||
import * as $2 from "./routes/_500.tsx";
|
||||
@@ -90,7 +89,6 @@ const manifest = {
|
||||
"./islands/kebab-case-counter-test.tsx": $$6,
|
||||
},
|
||||
baseUrl: import.meta.url,
|
||||
config,
|
||||
};
|
||||
|
||||
export default manifest;
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"imports": {
|
||||
"$fresh/": "../../",
|
||||
"preact": "https://esm.sh/preact@10.15.1",
|
||||
"preact/": "https://esm.sh/preact@10.15.1/",
|
||||
"preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.0.3",
|
||||
"@preact/signals": "https://esm.sh/*@preact/signals@1.1.3",
|
||||
"@preact/signals-core": "https://esm.sh/@preact/signals-core@1.2.3"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,11 @@
|
||||
{
|
||||
"importMap": "./import_map.json",
|
||||
"lock": false,
|
||||
"imports": {
|
||||
"$fresh/": "../../",
|
||||
"preact": "https://esm.sh/preact@10.15.1",
|
||||
"preact/": "https://esm.sh/preact@10.15.1/",
|
||||
"preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.0.3"
|
||||
},
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx",
|
||||
"jsxImportSource": "preact"
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// This file SHOULD be checked into source version control.
|
||||
// This file is automatically updated during development when running `dev.ts`.
|
||||
|
||||
import config from "./deno.json" assert { type: "json" };
|
||||
import * as $0 from "./routes/[...all].ts";
|
||||
import * as $1 from "./routes/index.tsx";
|
||||
|
||||
@@ -13,7 +12,6 @@ const manifest = {
|
||||
},
|
||||
islands: {},
|
||||
baseUrl: import.meta.url,
|
||||
config,
|
||||
};
|
||||
|
||||
export default manifest;
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"imports": {
|
||||
"$fresh/": "../../",
|
||||
"preact": "https://esm.sh/preact@10.15.1",
|
||||
"preact/": "https://esm.sh/preact@10.15.1/",
|
||||
"preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.0.3"
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,9 @@
|
||||
{
|
||||
"lock": false,
|
||||
"importMap": "./import-map.json"
|
||||
"imports": {
|
||||
"$fresh/": "../../",
|
||||
"preact": "https://esm.sh/preact@10.15.1",
|
||||
"preact/": "https://esm.sh/preact@10.15.1/",
|
||||
"preact-render-to-string": "https://esm.sh/preact-render-to-string@6.0.3?external=preact"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// This file SHOULD be checked into source version control.
|
||||
// This file is automatically updated during development when running `dev.ts`.
|
||||
|
||||
import config from "./deno.json" assert { type: "json" };
|
||||
import * as $0 from "./routes/index.tsx";
|
||||
import * as $$0 from "./islands/Island.tsx";
|
||||
|
||||
@@ -14,7 +13,6 @@ const manifest = {
|
||||
"./islands/Island.tsx": $$0,
|
||||
},
|
||||
baseUrl: import.meta.url,
|
||||
config,
|
||||
};
|
||||
|
||||
export default manifest;
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"imports": {
|
||||
"$fresh/": "../../",
|
||||
"preact": "https://esm.sh/preact@10.15.1",
|
||||
"preact/": "https://esm.sh/preact@10.15.1/",
|
||||
"preact-render-to-string": "https://esm.sh/preact-render-to-string@5.2.6?external=preact"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,11 @@
|
||||
{
|
||||
"lock": false,
|
||||
"importMap": "./import_map.json",
|
||||
"imports": {
|
||||
"$fresh/": "../../",
|
||||
"preact": "https://esm.sh/preact@10.15.1",
|
||||
"preact/": "https://esm.sh/preact@10.15.1/",
|
||||
"preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.0.3"
|
||||
},
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx",
|
||||
"jsxImportSource": "preact"
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// This file SHOULD be checked into source version control.
|
||||
// This file is automatically updated during development when running `dev.ts`.
|
||||
|
||||
import config from "./deno.json" assert { type: "json" };
|
||||
import * as $0 from "./routes/static.tsx";
|
||||
import * as $1 from "./routes/with-island.tsx";
|
||||
import * as $$0 from "./islands/Island.tsx";
|
||||
@@ -16,7 +15,6 @@ const manifest = {
|
||||
"./islands/Island.tsx": $$0,
|
||||
},
|
||||
baseUrl: import.meta.url,
|
||||
config,
|
||||
};
|
||||
|
||||
export default manifest;
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"imports": {
|
||||
"$fresh/": "../../",
|
||||
"preact": "https://esm.sh/preact@10.15.1",
|
||||
"preact/": "https://esm.sh/preact@10.15.1/",
|
||||
"preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.0.3"
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,14 @@
|
||||
"tasks": {
|
||||
"start": "deno run -A --watch=static/,routes/ dev.ts"
|
||||
},
|
||||
"importMap": "./import_map.json",
|
||||
"imports": {
|
||||
"$fresh/": "../../",
|
||||
"preact": "https://esm.sh/preact@10.11.0",
|
||||
"preact/": "https://esm.sh/preact@10.11.0/",
|
||||
"preact-render-to-string": "https://esm.sh/*preact-render-to-string@5.2.4",
|
||||
"@preact/signals": "https://esm.sh/*@preact/signals@1.0.3",
|
||||
"@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.0.1"
|
||||
},
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx",
|
||||
"jsxImportSource": "preact"
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// This file SHOULD be checked into source version control.
|
||||
// This file is automatically updated during development when running `dev.ts`.
|
||||
|
||||
import config from "./deno.json" assert { type: "json" };
|
||||
import * as $0 from "./routes/check-duplication.tsx";
|
||||
import * as $1 from "./routes/insert-cssrules.tsx";
|
||||
import * as $2 from "./routes/static.tsx";
|
||||
@@ -20,7 +19,6 @@ const manifest = {
|
||||
"./islands/InsertCssrules.tsx": $$1,
|
||||
},
|
||||
baseUrl: import.meta.url,
|
||||
config,
|
||||
};
|
||||
|
||||
export default manifest;
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"imports": {
|
||||
"$fresh/": "../../",
|
||||
"preact": "https://esm.sh/preact@10.11.0",
|
||||
"preact/": "https://esm.sh/preact@10.11.0/",
|
||||
"preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.0.3",
|
||||
"@preact/signals": "https://esm.sh/*@preact/signals@1.0.3",
|
||||
"@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.0.1"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user