esbuild-node-externals
Advanced tools
Comparing version 1.15.0 to 1.16.0
# Changelog | ||
## [1.16.0](https://github.com/pradel/esbuild-node-externals/compare/v1.15.0...v1.16.0) (2024-12-17) | ||
### Features | ||
* add forceExternalList option ([555ca9b](https://github.com/pradel/esbuild-node-externals/commit/555ca9bebbe423884e8171bb3b69a7077cbf1219)) | ||
## [1.15.0](https://github.com/pradel/esbuild-node-externals/compare/v1.14.0...v1.15.0) (2024-09-26) | ||
@@ -4,0 +11,0 @@ |
@@ -10,2 +10,3 @@ import type { Plugin } from 'esbuild'; | ||
allowList?: AllowList; | ||
forceExternalList?: AllowList; | ||
allowWorkspaces?: boolean; | ||
@@ -12,0 +13,0 @@ cwd?: string; |
@@ -26,2 +26,3 @@ "use strict"; | ||
const allowPredicate = options.allowList && (0, utils_1.createAllowPredicate)(options.allowList); | ||
const externalPredicate = options.forceExternalList && (0, utils_1.createAllowPredicate)(options.forceExternalList); | ||
return { | ||
@@ -54,2 +55,5 @@ name: 'node-externals', | ||
} | ||
if (externalPredicate === null || externalPredicate === void 0 ? void 0 : externalPredicate(args.path)) { | ||
return { path: args.path, external: true }; | ||
} | ||
return null; | ||
@@ -56,0 +60,0 @@ }); |
{ | ||
"name": "esbuild-node-externals", | ||
"version": "1.15.0", | ||
"version": "1.16.0", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "typings": "dist/index.d.ts", |
@@ -85,2 +85,6 @@ # esbuild-node-externals | ||
#### `options.forceExternalList` (default to `[]`) | ||
An array that forces packages to be treated as external, even if not in `package.json`, so they will be excluded from the bundle. Can accept exact strings ('module_name'), regex patterns (/^module_name/), or a function that accepts the module name and returns whether it should be externalized. | ||
#### `options.allowWorkspaces` (default to `false`) | ||
@@ -87,0 +91,0 @@ |
@@ -17,2 +17,3 @@ import type { Plugin } from 'esbuild'; | ||
allowList?: AllowList; | ||
forceExternalList?: AllowList; | ||
allowWorkspaces?: boolean; | ||
@@ -48,4 +49,5 @@ cwd?: string; | ||
options.allowList && createAllowPredicate(options.allowList); | ||
const externalPredicate = | ||
options.forceExternalList && createAllowPredicate(options.forceExternalList); | ||
return { | ||
@@ -87,2 +89,7 @@ name: 'node-externals', | ||
// Allow one last override to force a path/package to be treated as external | ||
if (externalPredicate?.(args.path)) { | ||
return { path: args.path, external: true }; | ||
} | ||
return null; | ||
@@ -89,0 +96,0 @@ }); |
Sorry, the diff of this file is not supported yet
32142
355
104