Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

exports-fallback

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exports-fallback

Create proxy directories by `exports` field in `package.json` for older environments

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

exports-fallback

Create proxy directories by exports field in package.json for older environments.

Parameters

-g Add created directories to .gitignore

-f Write names of created directories to files section in package.json

-h Show help

Example

Source package.json:

{
  "name": "test",
  "version": "1.0.0",
  "exports": {
    ".": {
      "import": "./dist/esm/index.js",
      "require": "./dist/index.js",
      "types": "./dist/ts/index.d.ts"
    },
    "./foo": {
      "import": "./dist/esm/foo/index.js",
      "require": "./dist/foo/index.js",
      "types": "./dist/ts/foo/index.d.ts"
    },
    "./bar": {
      "import": "./dist/esm/bar/index.js",
      "require": "./dist/bar/index.js",
      "types": "./dist/ts/bar/index.d.ts"
    },
    "./bar/baz": {
      "import": "./dist/esm/baz/index.js",
      "require": "./dist/baz/index.js",
      "types": "./dist/ts/baz/index.d.ts"
    }
  },
  "files": [
    "/dist"
  ]
}

Let's execure npx exports-fallback -gf. The result

├── package.json
|   bar
|   ├── baz
|   |   └── package.json
|   └── package.json
├── foo
|   └── package.json
└── .gitignore

Every created package.json will be something like

{
  "main": "../../dist/baz/index.js",
  "module": "../../dist/esm/baz/index.js",
  "types": "../../dist/ts/baz/index.d.ts",
  "typings": "../../dist/ts/baz/index.d.ts"
}

Some new lines will be added to the root package.json:

  "files": [
    "/dist",
    "foo",
    "bar"
  ]

Script also will create .gitignore (or change existed):

foo
!/*/foo
bar
!/*/bar

Keywords

FAQs

Package last updated on 01 Sep 2024

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc