Gathering detailed insights and metrics for rollup-plugin-eik-import-map
Gathering detailed insights and metrics for rollup-plugin-eik-import-map
Gathering detailed insights and metrics for rollup-plugin-eik-import-map
Gathering detailed insights and metrics for rollup-plugin-eik-import-map
Rollup plugin to transform "bare" import specifiers to absolute URLs in ES modules
npm install rollup-plugin-eik-import-map
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
18 Stars
119 Commits
1 Forks
3 Watchers
7 Branches
3 Contributors
Updated on Oct 03, 2024
Latest Version
1.0.0
Package Id
rollup-plugin-eik-import-map@1.0.0
Unpacked Size
15.19 kB
Size
4.21 kB
File Count
7
NPM Version
6.14.5
Node Version
12.18.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
6
Rollup Eik plugin to support the use of import maps to map "bare" import specifiers in ES modules.
1$ npm install rollup-plugin-eik-import-map
1import eikImportMapPlugin from "rollup-plugin-eik-import-map"; 2 3export default { 4 input: "source/main.js", 5 plugins: [eikImportMapPlugin()], 6 output: { 7 file: "build.js", 8 format: "esm", 9 }, 10};
This plugin transforms "bare" import specifiers to absolute URL specifiers in ES modules. The module refered to by the "bare" import specifier will be treated as external and its source will not be included in the bundle but refered to by URL.
The plugin will attempt to read import map URLs from eik.json
if present.
1export default { 2 input: "source/main.js", 3 plugins: [eikImportMapPlugin()], 4 output: { 5 file: "build.js", 6 format: "esm", 7 }, 8};
The path to the location of an eik.json
file can be specified with the path
option.
1export default { 2 input: "source/main.js", 3 plugins: [eikImportMapPlugin({ path: "/path/to/eik.json" })], 4 output: { 5 file: "build.js", 6 format: "esm", 7 }, 8};
The plugin can also be told which URLs to load import maps from directly using the urls
option.
1export default { 2 input: "source/main.js", 3 plugins: [eikImportMapPlugin({ urls: `http://myserver/import-map` })], 4 output: { 5 file: "build.js", 6 format: "esm", 7 }, 8};
Additionally, individual mappings can be specified using the imports
option.
1export default { 2 input: "source/main.js", 3 plugins: [ 4 eikImportMapPlugin({ 5 imports: { 6 "lit-element": "https://cdn.pika.dev/lit-element/v2", 7 }, 8 }), 9 ], 10 output: { 11 file: "build.js", 12 format: "esm", 13 }, 14};
If several of these options are used, imports
takes precedence over urls
which takes precedence over values loaded from an eik.json
file.
ie. in the following example
1export default { 2 input: 'source/main.js', 3 plugins: [eikImportMapPlugin({ 4 path: '/path/to/eik.json', 5 urls: ['http://myserver/import-map'] 6 imports: { 7 'lit-element': 'https://cdn.pika.dev/lit-element/v2', 8 }, 9 })], 10 output: { 11 file: 'build.js', 12 format: 'esm' 13 } 14};
Any import map URLs in eik.json
will be loaded first, then merged with (and overridden if necessary by) the result of fetching from http://myserver/import-map
before finally being merged with (and overriden if necessary by) specific mappings defined in imports
. (In this case lit-element
)
Bundles will have bare imports mapped to absolute URLs.
Ie. Something like this...
1import { LitElement, html, css } from "lit-element";
Will be mapped to something like this...
1import { LitElement, html, css } from "https://cdn.pika.dev/lit-element/v2";
This plugin takes an import map as options:
option | default | type | required | details |
---|---|---|---|---|
path | cwd/eik.json | string | false | Path to eik.json file. |
urls | [] | array | false | Array of import map URLs to fetch from. |
imports | {} | object | false | Mapping between "bare" import specifiers and absolute URLs. |
This module only cares about "bare" import specifiers which map to absolute URLs in the import map. Any other import specifiers defined in the import map are ignored.
Any mappings defined by any of the means described above must not occur in the Rollup external
option.
If so, this module will throw.
In other words, this will not work:
1export default { 2 input: "source/main.js", 3 external: ["lit-element"], 4 plugins: [ 5 eikImportMapPlugin({ 6 imports: { 7 "lit-element": "https://cdn.pika.dev/lit-element/v2", 8 }, 9 }), 10 ], 11 output: { 12 file: "build.js", 13 format: "esm", 14 }, 15};
This module will only work when the output is ES modules.
Copyright (c) 2020 Finn.no
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 1/17 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More