Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hyrious/esbuild-plugin-commonjs

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hyrious/esbuild-plugin-commonjs - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

45

index.d.ts

@@ -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 };

3

package.json
{
"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",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc