@hyrious/esbuild-plugin-commonjs
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -30,7 +30,36 @@ import { Plugin } from 'esbuild'; | ||
*/ | ||
transform?: boolean | ((path: string) => TransformConfig | null | void); | ||
transform?: boolean | ((path: string) => boolean | TransformConfig | null | void); | ||
/** | ||
* _Experimental_: This options acts as a fallback of the `transform` option above. | ||
*/ | ||
transformConfig?: Pick<TransformConfig, "behavior" | "sideEffects">; | ||
transformConfig?: Pick<TransformConfig, 'behavior' | 'sideEffects'>; | ||
/** | ||
* Controls which style of import should be used. By default, it transforms: | ||
* | ||
* ```js | ||
* // input | ||
* const foo = require("foo") | ||
* // output | ||
* import foo from "foo" | ||
* ``` | ||
* | ||
* The above case is often correct when 'foo' is also a commonjs module. | ||
* But if 'foo' has es module exports, it is better to use: | ||
* | ||
* ```js | ||
* // output | ||
* import * as foo from "foo" | ||
* ``` | ||
* | ||
* In which case you can set `requireReturnsDefault` to `false` to get the above output. | ||
* Or use the callback style to control the behavior for each module. | ||
* | ||
* @default true | ||
*/ | ||
requireReturnsDefault?: boolean | ((path: string) => boolean); | ||
/** | ||
* Don't replace require("ignored-modules"). Note that this will cause | ||
* esbuild generates the __require() wrapper which throw error at runtime. | ||
*/ | ||
ignore?: string[] | ((path: string) => boolean); | ||
} | ||
@@ -48,3 +77,3 @@ interface TransformConfig { | ||
*/ | ||
behavior?: "babel" | "node"; | ||
behavior?: 'babel' | 'node'; | ||
/** | ||
@@ -62,3 +91,3 @@ * Also include these named exports if they aren't recognized automatically. | ||
* var mod; | ||
* var exports = /+ @__PURE__ +/ ((exports, module) => { | ||
* var exports = /\*#__PURE__*\/ ((exports, module) => { | ||
* // ... original content ... | ||
@@ -68,13 +97,11 @@ * return module.exports; | ||
* export default exports; | ||
* var a_b = /+ @__PURE__ +/ (() => exports['a-b'])(); | ||
* var something = /+ @__PURE__ +/ (() => exports.something)(); | ||
* var a_b = /\*#__PURE__*\/ (() => exports['a-b'])(); | ||
* var something = /\*#__PURE__*\/ (() => exports.something)(); | ||
* export { a_b as "a-b", something }; | ||
* ``` | ||
* | ||
* Note: the `/+ @__PURE__ +/` above is actually `'/' + '* @__PURE__ *' + '/'`. | ||
*/ | ||
sideEffects?: boolean; | ||
} | ||
declare function commonjs({ filter, transform, transformConfig, }?: CommonJSOptions): Plugin; | ||
declare function commonjs({ filter, transform, transformConfig, requireReturnsDefault, ignore, }?: CommonJSOptions): Plugin; | ||
export { type CommonJSOptions, type TransformConfig, commonjs, commonjs as default }; |
{ | ||
"name": "@hyrious/esbuild-plugin-commonjs", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "Bundle commonjs externals in es module in esbuild.", | ||
@@ -14,2 +14,3 @@ "author": "hyrious <hyrious@outlook.com>", | ||
], | ||
"repository": "hyrious/esbuild-plugin-commonjs", | ||
"main": "index.js", | ||
@@ -16,0 +17,0 @@ "types": "index.d.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
47495
885