deno-importmap
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

ImportMap

Implementation of import maps.

This is a port of the Deno module importmap to Nodejs.

Example

import {
  resolveImportMap,
  resolveModuleSpecifier,
} from "deno-importmap";

const importMap: ImportMap = {
  imports: {
    "./foo/": "./bar/",
  },
};
const importMapBaseURL = new URL(import.meta.url);
const moduleSpecifier = "./foo/test.js";
const baseURL = new URL(import.meta.url);
const resolvedImportMap = resolveImportMap(importMap, importMapBaseURL); // { imports: { "file:///project/dir/foo/": "file:///project/dir/bar/" }, scopes: {} }
const resolvedeModuleSpecifier = resolveModuleSpecifier(
  moduleSpecifier,
  resolvedImportMap,
  baseURL,
); // file:///project/dir/bar/test.js

Package Sidebar

Install

npm i deno-importmap

Weekly Downloads

341

Version

0.2.1

License

MIT

Unpacked Size

87.2 kB

Total Files

36

Last publish

Collaborators

  • dalcib