
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
import-maps-generator
Advanced tools
Generate import maps to achieve true buildless development. Uses `@jspm/generator` under the hood. Built on `Bun` and uses `HTMLRewriter` for the best performance. Works fine with Node.js also ## Usage It needs js/html input file and provides html/json ou
Generate import maps to achieve true buildless development. Uses @jspm/generator under the hood. Built on Bun and uses HTMLRewriter for the best performance. Works fine with Node.js also
It needs js/html input file and provides html/json output
bun generateImportMaps.js --input=./tests/assets/test-element.js --output=./tests/assets/testResult.html
Or
node generateImportMaps.js --input=./tests/assets/test-element.js --output=./tests/assets/testResult.html
Or
import {generateImportMaps} from 'import-maps-generator'
await generateImportMaps({input:'./tests/assets/test-element.js', output:'./tests/assets/testResult.html'})
Output:
<!DOCTYPE html>
<html lang="en">
<head><script type="importmap">
{
"imports": {
"lit": "../../node_modules/lit/index.js"
},
"scopes": {
"../../node_modules/": {
"@lit/reactive-element": "../../node_modules/@lit/reactive-element/reactive-element.js",
"lit-element/lit-element.js": "../../node_modules/lit-element/lit-element.js",
"lit-html": "../../node_modules/lit-html/lit-html.js",
"lit-html/is-server.js": "../../node_modules/lit-html/is-server.js"
}
}
}
</script>
<meta charset="UTF-8">
<title>test result</title>
<script type="module" src="test-element.js"></script>
</head>
<body>
<test-element></test-element>
</body>
</html>
/**
* Generates import maps based on the provided input file and writes the result to the output file.
*
* @param {Object} options - The options for generating import maps.
* @param {string} options.input - The path to the JS input file. If not provided, the value from the `process.env.input` environment variable is used.
* @param {string} options.output - The path to the HTML output file. If not provided, the value from the `process.env.output` environment variable is used.
* @param {boolean} options.rewriteExistingMap - Indicates whether to rewrite the Import Maps of the HTML output file with the generated import maps. If not provided, the value from the `process.env.rewriteExistingMap` environment variable is used. Defaults to `true`.
* @param {boolean} options.writeToDisk - Indicates whether to write the Output to disk. If not provided, the value from the `process.env.rewriteExistingMap` environment variable is used. Defaults to `true`.
* @return {Promise<string>} - A promise that resolves to the generated import map as a string if `output` is not provided.
*/
app.use(staticPlugin({assets: './frontend', prefix:'/'}));
app.use(staticPlugin({assets: './node_modules', prefix:'/node_modules'}));
I had problems with lit on bun+elysia. The classic
TypeError: Failed to resolve module specifier "lit". Relative references must start with either "/", "./", or "../".
I tried to find something like koa-node-resolve but for Elysia.js and not found such a thing. So I decided to generate import maps.
I tried JSPM CLI(and Bun version not worked well, so I used it from node), and found out that since I used custom routing for my project I cannot use CLI. So I used @jspm/generator which cannot write to html file as JSPM CLI does.
This project solves problems I had:
FAQs
Generate import maps to achieve true buildless development. Uses `@jspm/generator` under the hood. Built on `Bun` and uses `HTMLRewriter` for the best performance. Works fine with Node.js also ## Usage It needs js/html input file and provides html/json ou
The npm package import-maps-generator receives a total of 0 weekly downloads. As such, import-maps-generator popularity was classified as not popular.
We found that import-maps-generator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.