Socket
Socket
Sign inDemoInstall

exports-fallback

Package Overview
Dependencies
5
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

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


Version published
Weekly downloads
3
Maintainers
1
Install size
186 kB
Created
Weekly downloads
 

Readme

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
bar

Keywords

FAQs

Last updated on 22 Mar 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc