esbuild-plugins-node-modules-polyfill
Advanced tools
Comparing version 1.6.1-next.00f97eb.0 to 1.6.1-next.29faf77.0
@@ -7,3 +7,3 @@ 'use strict'; | ||
var localPkg = require('local-pkg'); | ||
var esbuild = require('esbuild'); | ||
var promises = require('fs/promises'); | ||
var resolve_exports = require('resolve.exports'); | ||
@@ -41,3 +41,3 @@ | ||
__require.resolve(`@jspm/core/nodelibs/${importPath}`), | ||
// ensure "fs/promises" is resolved properly | ||
// ensure sub path modules are resolved properly | ||
"../../.." + (importPath.includes("/") ? "/.." : "") | ||
@@ -71,8 +71,3 @@ ); | ||
const exportFullPath = await getCachedPolyfillPath(importPath); | ||
const content = (await esbuild.build({ | ||
write: false, | ||
format: "esm", | ||
bundle: true, | ||
entryPoints: [exportFullPath] | ||
})).outputFiles[0].text; | ||
const content = await promises.readFile(exportFullPath, "utf8"); | ||
return content.replace(/eval\(/g, "(0,eval)("); | ||
@@ -260,8 +255,2 @@ }, "polyfillContentAndTransform"); | ||
}, "nodeModulesPolyfillPlugin"); | ||
/** | ||
* `polyfillPath` and `getCachedPolyfillContent` are taken from below source with some modifications for my use case. | ||
* https://github.com/Aslemammad/modern-node-polyfills | ||
* @author Aslemammad | ||
* @license MIT | ||
*/ | ||
@@ -268,0 +257,0 @@ exports.commonJsTemplate = commonJsTemplate; |
{ | ||
"name": "esbuild-plugins-node-modules-polyfill", | ||
"version": "1.6.1-next.00f97eb.0", | ||
"version": "1.6.1-next.29faf77.0", | ||
"description": "Polyfills nodejs builtin modules and globals for the browser.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
48760
275
5