From d2a6deb3dd5579f2bb90fc225bf518d7ca563a15 Mon Sep 17 00:00:00 2001 From: dmail Date: Tue, 28 Nov 2023 16:00:53 +0100 Subject: [PATCH] doc update --- README.MD | 29 +++++-------------- docs/demo/generate_importmap.mjs | 2 +- docs/demo/index.html | 21 ++++++++++++++ src/step_write_into_files/write_into_files.js | 10 +++++++ 4 files changed, 39 insertions(+), 23 deletions(-) create mode 100644 docs/demo/index.html diff --git a/README.MD b/README.MD index 92e50289..463b1f96 100644 --- a/README.MD +++ b/README.MD @@ -42,7 +42,7 @@ import { writeImportmaps } from "@jsenv/importmap-node-module"; await writeImportmaps({ projectDirectoryUrl: new URL("./", import.meta.url), importmaps: { - "./project.importmap": { + "./index.html": { mappingsForNodeResolution: true, }, }, @@ -59,7 +59,7 @@ npm install --save-dev @jsenv/importmap-node-module ```console node ./generate_importmap.mjs --> /Users/d.maillard/importmap-node-module/docs/demo/project.importmap + - - - - - - +At the time of writing this documentation external importmap are not supported by web browsers: + +```console +External import maps are not yet supported ``` -If you use a bundler or an other tool, be sure it's compatible with import maps. -As import map are standard the bundler/tool might be compatible by default or with the help of some plugin/configuration. +If you plan to use importmap in a web browser you need to tell `@jsenv/importmap-node-module` to inline importmap into the HTML file as show in [API](#API). # TypeScript diff --git a/docs/demo/generate_importmap.mjs b/docs/demo/generate_importmap.mjs index de889d1e..5894d16d 100644 --- a/docs/demo/generate_importmap.mjs +++ b/docs/demo/generate_importmap.mjs @@ -3,7 +3,7 @@ import { writeImportmaps } from "@jsenv/importmap-node-module"; await writeImportmaps({ projectDirectoryUrl: new URL("./", import.meta.url), importmaps: { - "./project.importmap": { + "./index.html": { mappingsForNodeResolution: true, }, }, diff --git a/docs/demo/index.html b/docs/demo/index.html new file mode 100644 index 00000000..8211a09d --- /dev/null +++ b/docs/demo/index.html @@ -0,0 +1,21 @@ + + + + Title + + + + + + + + + \ No newline at end of file diff --git a/src/step_write_into_files/write_into_files.js b/src/step_write_into_files/write_into_files.js index f7abec3e..6d1314bf 100644 --- a/src/step_write_into_files/write_into_files.js +++ b/src/step_write_into_files/write_into_files.js @@ -55,6 +55,11 @@ const writeIntoHtmlFile = (htmlFileUrl, importmapAsJson, { logger }) => { setHtmlNodeAttributes(scriptTypeImportmap, { "content-indented": undefined, }); + logger.info( + `