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

esbuild-plugins-node-modules-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
365
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-plugins-node-modules-polyfill - npm Package Compare versions

Comparing version 1.0.6-next.edfce5d.0 to 1.0.6

13

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

# [1.0.6](https://github.com/imranbarbhuiya/esbuild-plugins-node-modules-polyfill/compare/v1.0.5...v1.0.6) - (2022-10-08)
## 📝 Documentation
- Update readme ([784bd89](https://github.com/imranbarbhuiya/esbuild-plugins-node-modules-polyfill/commit/784bd89cce3562022a71625e0f6fec6356f01c6d))
- Fix changelog ([910fdf8](https://github.com/imranbarbhuiya/esbuild-plugins-node-modules-polyfill/commit/910fdf86e2ac03cfcdd545be4da4f963470362db))
# [1.0.3](https://github.com/imranbarbhuiya/esbuild-plugins-node-modules-polyfill/compare/v1.0.2...v1.0.3) - (2022-08-05)

@@ -10,2 +17,8 @@

- Remove comment ([96a9d0e](https://github.com/imranbarbhuiya/esbuild-plugins-node-modules-polyfill/commit/96a9d0e3837b35f1831d226ac3f6ffc96ef29170))
# [1.0.3](https://github.com/imranbarbhuiya/esbuild-plugins-node-modules-polyfill/compare/v1.0.2...v1.0.3) - (2022-08-05)
## 🪞 Styling
- Remove comment ([96a9d0e](https://github.com/imranbarbhuiya/esbuild-plugins-node-modules-polyfill/commit/96a9d0e3837b35f1831d226ac3f6ffc96ef29170))

@@ -12,0 +25,0 @@

0

dist/index.d.ts

@@ -0,0 +0,0 @@ import { Plugin } from 'esbuild';

62

dist/index.js

@@ -39,3 +39,3 @@ "use strict";

var escapeRegex = /* @__PURE__ */ __name((str) => {
return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
return str.replace(/[$()*+.?[\\\]^{|}]/g, "\\$&").replaceAll("-", "\\x2d");
}, "escapeRegex");

@@ -60,6 +60,34 @@ var removeEndingSlash = /* @__PURE__ */ __name((str) => {

// src/lib/plugin.ts
var import_node_module = require("module");
var import_node_path = __toESM(require("path"));
var import_modern_node_polyfills = require("modern-node-polyfills");
var import_module = require("module");
var NAME = "node-modules-polyfills";
var loader = /* @__PURE__ */ __name(async (args) => {
try {
const isCommonjs = args.namespace.endsWith("commonjs");
const resolved = await (0, import_modern_node_polyfills.polyfillPath)(removeEndingSlash(args.path));
const contents = await (0, import_modern_node_polyfills.polyfillContent)(removeEndingSlash(args.path));
const resolveDir = import_node_path.default.dirname(resolved);
if (isCommonjs) {
return {
loader: "js",
contents: commonJsTemplate({
importPath: args.path
}),
resolveDir
};
}
return {
loader: "js",
contents,
resolveDir
};
} catch (error) {
console.error("node-modules-polyfill", error);
return {
contents: `export {}`,
loader: "js"
};
}
}, "loader");
var nodeModulesPolyfillPlugin = /* @__PURE__ */ __name((options = {}) => {

@@ -79,33 +107,5 @@ const { namespace = NAME, name = NAME } = options;

}
const loader = /* @__PURE__ */ __name(async (args) => {
try {
const isCommonjs = args.namespace.endsWith("commonjs");
const resolved = await (0, import_modern_node_polyfills.polyfillPath)(removeEndingSlash(args.path));
const contents = await (0, import_modern_node_polyfills.polyfillContent)(removeEndingSlash(args.path));
const resolveDir = import_node_path.default.dirname(resolved);
if (isCommonjs) {
return {
loader: "js",
contents: commonJsTemplate({
importPath: args.path
}),
resolveDir
};
}
return {
loader: "js",
contents,
resolveDir
};
} catch (e) {
console.error("node-modules-polyfill", e);
return {
contents: `export {}`,
loader: "js"
};
}
}, "loader");
onLoad({ filter: /.*/, namespace }, loader);
onLoad({ filter: /.*/, namespace: commonjsNamespace }, loader);
const filter = new RegExp(`(?:node:)?${import_module.builtinModules.map(escapeRegex).join("|")}`);
const filter = new RegExp(`(?:node:)?${import_node_module.builtinModules.map(escapeRegex).join("|")}`);
const resolver = /* @__PURE__ */ __name(async (args) => {

@@ -112,0 +112,0 @@ const ignoreRequire = args.namespace === commonjsNamespace;

{
"name": "esbuild-plugins-node-modules-polyfill",
"version": "1.0.6-next.edfce5d.0",
"version": "1.0.6",
"description": "Polyfills nodejs builtin modules for the browser.",

@@ -31,3 +31,6 @@ "main": "dist/index.js",

"esbuild-plugins-node-modules-polyfill",
"node-modules-polyfill"
"node-modules-polyfill",
"esbuild",
"esbuild-plugin",
"polyfill"
],

@@ -37,13 +40,8 @@ "devDependencies": {

"@commitlint/config-conventional": "^17.1.0",
"@favware/cliff-jumper": "^1.8.7",
"@favware/cliff-jumper": "^1.8.8",
"@favware/npm-deprecate": "^1.0.5",
"@sapphire/eslint-config": "^4.3.8",
"@sapphire/prettier-config": "^1.4.4",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0",
"cz-conventional-changelog": "^3.3.0",
"esbuild": "^0.15.9",
"eslint": "^8.24.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"esbuild": "^0.15.10",
"eslint": "^8.25.0",
"eslint-config-mahir": "^0.0.8",
"husky": "^8.0.1",

@@ -53,5 +51,4 @@ "lint-staged": "^13.0.3",

"prettier": "^2.7.1",
"pretty-quick": "^3.1.3",
"tsup": "^6.2.3",
"typescript": "^4.8.3"
"typescript": "^4.8.4"
},

@@ -88,4 +85,3 @@ "files": [

},
"packageManager": "yarn@3.2.3",
"prettier": "@sapphire/prettier-config",
"packageManager": "yarn@3.2.4",
"dependencies": {

@@ -92,0 +88,0 @@ "modern-node-polyfills": "^0.0.9"

@@ -21,2 +21,3 @@ <div align="center">

- Full TypeScript & JavaScript support
- Supports `node:` protocol

@@ -36,3 +37,3 @@ ## Install

build({
plugins: [nodeModulesPolyfillPlugin()]
plugins: [nodeModulesPolyfillPlugin()],
});

@@ -39,0 +40,0 @@ ```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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