esbuild-node-externals
Advanced tools
Comparing version 1.0.1 to 1.0.2
# Changelog | ||
### [1.0.2](https://www.github.com/pradel/esbuild-node-externals/compare/v1.0.1...v1.0.2) (2021-01-31) | ||
### Bug Fixes | ||
* scoped packages are now marked as externals ([#10](https://www.github.com/pradel/esbuild-node-externals/issues/10)) ([85cb23c](https://www.github.com/pradel/esbuild-node-externals/commit/85cb23c231e3073c7347020636aca4a01df1af5e)) | ||
### Miscellaneous | ||
* upgrade deps ([#8](https://www.github.com/pradel/esbuild-node-externals/issues/8)) ([d1a283f](https://www.github.com/pradel/esbuild-node-externals/commit/d1a283f3ab2ca2d13952af1b1e1ab387f7015083)) | ||
### [1.0.1](https://www.github.com/pradel/esbuild-node-externals/compare/v1.0.0...v1.0.1) (2020-11-18) | ||
@@ -4,0 +16,0 @@ |
@@ -5,3 +5,3 @@ "use strict"; | ||
const utils_1 = require("./utils"); | ||
exports.nodeExternalsPlugin = (paramsOptions = {}) => { | ||
const nodeExternalsPlugin = (paramsOptions = {}) => { | ||
const options = Object.assign(Object.assign({ dependencies: true, devDependencies: true, peerDependencies: true, optionalDependencies: true }, paramsOptions), { packagePath: paramsOptions.packagePath && typeof paramsOptions.packagePath === 'string' | ||
@@ -25,3 +25,8 @@ ? [paramsOptions.packagePath] | ||
// To allow sub imports from packages we take only the first path to deduct the name | ||
const moduleName = args.path.split('/')[0]; | ||
let moduleName = args.path.split('/')[0]; | ||
// In case of scoped package | ||
if (args.path.startsWith('@')) { | ||
const split = args.path.split('/'); | ||
moduleName = `${split[0]}/${split[1]}`; | ||
} | ||
// Mark the module as external so it is not resolved | ||
@@ -36,3 +41,4 @@ if (nodeModules.includes(moduleName)) { | ||
}; | ||
exports.nodeExternalsPlugin = nodeExternalsPlugin; | ||
exports.default = exports.nodeExternalsPlugin; | ||
//# sourceMappingURL=index.js.map |
@@ -24,3 +24,3 @@ "use strict"; | ||
*/ | ||
exports.findPackagePaths = () => { | ||
const findPackagePaths = () => { | ||
// Find git root if in git repository | ||
@@ -41,6 +41,7 @@ const gitDirectoryPath = find_up_1.default.sync('.git', { | ||
}; | ||
exports.findPackagePaths = findPackagePaths; | ||
/** | ||
* Return an array of the package.json dependencies that should be excluded from the build. | ||
*/ | ||
exports.findDependencies = (options) => { | ||
const findDependencies = (options) => { | ||
const packageJsonKeys = [ | ||
@@ -68,2 +69,3 @@ options.dependencies && 'dependencies', | ||
}; | ||
exports.findDependencies = findDependencies; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "esbuild-node-externals", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"main": "dist/index.js", | ||
@@ -27,10 +27,10 @@ "typings": "dist/index.d.ts", | ||
"devDependencies": { | ||
"@types/node": "14.14.8", | ||
"esbuild": "0.8.10", | ||
"typescript": "4.0.5" | ||
"@types/node": "14.14.22", | ||
"esbuild": "0.8.38", | ||
"typescript": "4.1.3" | ||
}, | ||
"dependencies": { | ||
"find-up": "5.0.0", | ||
"tslib": "2.0.3" | ||
"tslib": "2.1.0" | ||
} | ||
} |
@@ -41,4 +41,10 @@ import { Plugin } from 'esbuild'; | ||
// To allow sub imports from packages we take only the first path to deduct the name | ||
const moduleName = args.path.split('/')[0]; | ||
let moduleName = args.path.split('/')[0]; | ||
// In case of scoped package | ||
if (args.path.startsWith('@')) { | ||
const split = args.path.split('/'); | ||
moduleName = `${split[0]}/${split[1]}`; | ||
} | ||
// Mark the module as external so it is not resolved | ||
@@ -45,0 +51,0 @@ if (nodeModules.includes(moduleName)) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
18821
257
+ Addedtslib@2.1.0(transitive)
- Removedtslib@2.0.3(transitive)
Updatedtslib@2.1.0