Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: CommonJS and ES Modules compatibility
- Loading branch information
Showing
7 changed files
with
68 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"targets": "defaults", | ||
"modules": "commonjs" | ||
} | ||
] | ||
], | ||
"plugins": ["@babel/plugin-transform-runtime"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cat >lib/cjs/package.json <<!EOF | ||
{ | ||
"type": "commonjs" | ||
} | ||
!EOF | ||
|
||
cat >lib/esm/package.json <<!EOF | ||
{ | ||
"type": "module" | ||
} | ||
!EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = require('./lib/index').default; | ||
module.exports = require('./lib/cjs/index').default; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,20 +4,18 @@ | |
"author": "Rubén Norte <ruben.norte@softonic.com>", | ||
"description": "Axios plugin that intercepts failed requests and retries them whenever posible.", | ||
"license": "Apache-2.0", | ||
"main": "index.js", | ||
"homepage": "https://github.com/softonic/axios-retry", | ||
"files": [ | ||
"es", | ||
"lib", | ||
"index.js", | ||
"index.d.ts" | ||
], | ||
"scripts": { | ||
"lint": "eslint es/**/*.mjs spec/**/*.spec.mjs", | ||
"pretest": "npm run lint", | ||
"test": "NODE_OPTIONS=--es-module-specifier-resolution=node jasmine", | ||
"prebuild": "npm run test", | ||
"build": "rm -rf lib && babel es -d lib --source-maps", | ||
"build": "rm -rf lib && babel es -d lib/esm --source-maps && babel es -d lib/cjs --config-file ./babel.config.cjs.json --source-maps && ./fixup", | ||
"prerelease": "npm run build", | ||
"release": "npm version -m \"New version: %s\"", | ||
"postrelease": "npm run push && npm publish", | ||
|
@@ -32,14 +30,15 @@ | |
"*.js": "eslint --cache --fix" | ||
}, | ||
"dependencies": { | ||
"is-retry-allowed": "^3.0.0" | ||
"is-retry-allowed": "^2.2.0" | ||
}, | ||
"peerDependencies": { | ||
"axios": ">=0.21.2" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.15.7", | ||
"@babel/core": "^7.15.5", | ||
"@babel/plugin-transform-runtime": "^7.15.8", | ||
"@babel/preset-env": "^7.15.6", | ||
"axios": "^0.21.2", | ||
"eslint": "^7.32.0", | ||
|
@@ -61,5 +60,16 @@ | |
"bugs": { | ||
"url": "https://github.com/softonic/axios-retry/issues" | ||
}, | ||
"typings": "./index.d.ts" | ||
"typings": "./index.d.ts", | ||
"engines": { | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mindhells
Author
Member
|
||
}, | ||
"main": "lib/cjs/index.js", | ||
"module": "lib/esm/index.js", | ||
"exports": { | ||
".": { | ||
"import": "./lib/esm/index.js", | ||
"require": "./index.js" | ||
} | ||
} | ||
} |
This change makes the library not working in Node 15. So basically, all the projects which are on Node 15 started failing.