Socket
Socket
Sign inDemoInstall

check-export-map

Package Overview
Dependencies
2
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

check-export-map

Check if entries in an export map in package.json are valid and point to actual files/folders


Version published
Weekly downloads
628
decreased by-26.03%
Maintainers
1
Install size
80.6 kB
Created
Weekly downloads
 

Readme

Source

Check export maps

A simple cli tool that checks if the export map defined in a package.json file is correct and that the referenced files/folders exist.

Rules:

  • Entries must start with a .
  • Must have the following entries:
    • . = main export when you do import * as foo from "my-package"
    • ./package.json = allow user to import the package's package.json file
  • Entry type import must end with .mjs
  • Entry file paths must be relative and start with a .
  • All referenced files/folders must exist on disk

Example of a valid export map in package.json:

{
  "name": "preact",
  "exports": {
    ".": {
      "browser": "./dist/preact.module.js",
      "umd": "./dist/preact.umd.js",
      "import": "./dist/preact.mjs",
      "require": "./dist/preact.js"
    },
    "./compat": {
      "browser": "./compat/dist/compat.module.js",
      "umd": "./compat/dist/compat.umd.js",
      "import": "./compat/dist/compat.mjs",
      "require": "./compat/dist/compat.js"
    },
    "./compat/server": {
      "require": "./compat/server.js"
    },
    "./package.json": "./package.json"
  }
}

Usage

Add the package via:

npm install -D check-export-map
# yarn
yarn add -D check-export-map

...and add an script to your package.json:

{
	"name": "my-package",
	"scripts": {
		"test": "check-export-map"
	}
}

Global installation

You can install check-export-map globally to invoke it from any directory.

npm install -g check-export-map

CLI documentation

Check if the export map declared in package.json is valid.

Usage
  check-export-map [options] <...FILES>
	
Options
  -v, --version    Displays current version
  -h, --help       Displays this message

LICENSE

MIT, see the LICENSE file.

FAQs

Last updated on 24 Nov 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc