@esbuild-plugins/node-modules-polyfill
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -1,2 +0,2 @@ | ||
import type { Plugin } from 'esbuild'; | ||
import { Plugin } from 'esbuild'; | ||
export interface NodePolyfillsOptions { | ||
@@ -3,0 +3,0 @@ name?: string; |
@@ -17,4 +17,6 @@ "use strict"; | ||
const escape_string_regexp_1 = __importDefault(require("escape-string-regexp")); | ||
const fs_1 = __importDefault(require("fs")); | ||
const path_1 = __importDefault(require("path")); | ||
const modules_1 = require("rollup-plugin-polyfill-node/dist/modules"); | ||
const polyfills_1 = require("./polyfills"); | ||
// import { NodeResolvePlugin } from '@esbuild-plugins/node-resolve' | ||
const NAME = 'node-modules-polyfills'; | ||
@@ -35,3 +37,3 @@ const NAMESPACE = NAME; | ||
const commonjsNamespace = namespace + '-commonjs'; | ||
const polyfilledBuiltins = modules_1.getModules(); | ||
const polyfilledBuiltins = polyfills_1.builtinsPolyfills(); | ||
const polyfilledBuiltinsNames = [...polyfilledBuiltins.keys()]; | ||
@@ -55,5 +57,5 @@ return { | ||
const isCommonjs = args.namespace.endsWith('commonjs'); | ||
const key = removeEndingSlash(argsPath); | ||
const contents = polyfilledBuiltins.get(key); | ||
const resolveDir = path_1.default.dirname(key); | ||
const resolved = polyfilledBuiltins.get(removeEndingSlash(argsPath)); | ||
const contents = yield (yield fs_1.default.promises.readFile(resolved)).toString(); | ||
let resolveDir = path_1.default.dirname(resolved); | ||
if (isCommonjs) { | ||
@@ -60,0 +62,0 @@ return { |
@@ -1,2 +0,2 @@ | ||
import type { Plugin } from 'esbuild'; | ||
import { Plugin } from 'esbuild'; | ||
export interface NodePolyfillsOptions { | ||
@@ -3,0 +3,0 @@ name?: string; |
@@ -11,4 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import escapeStringRegexp from 'escape-string-regexp'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import { getModules as builtinsPolyfills } from 'rollup-plugin-polyfill-node/dist/modules'; | ||
import { builtinsPolyfills } from './polyfills'; | ||
// import { NodeResolvePlugin } from '@esbuild-plugins/node-resolve' | ||
const NAME = 'node-modules-polyfills'; | ||
@@ -48,5 +50,5 @@ const NAMESPACE = NAME; | ||
const isCommonjs = args.namespace.endsWith('commonjs'); | ||
const key = removeEndingSlash(argsPath); | ||
const contents = polyfilledBuiltins.get(key); | ||
const resolveDir = path.dirname(key); | ||
const resolved = polyfilledBuiltins.get(removeEndingSlash(argsPath)); | ||
const contents = yield (yield fs.promises.readFile(resolved)).toString(); | ||
let resolveDir = path.dirname(resolved); | ||
if (isCommonjs) { | ||
@@ -53,0 +55,0 @@ return { |
{ | ||
"name": "@esbuild-plugins/node-modules-polyfill", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "", | ||
@@ -22,9 +22,9 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"rollup": "^2.75.7", | ||
"safe-buffer": "^5.2.1", | ||
"test-support": "*" | ||
"test-support": "*", | ||
"@esbuild-plugins/node-globals-polyfill": "*" | ||
}, | ||
"dependencies": { | ||
"escape-string-regexp": "^4.0.0", | ||
"rollup-plugin-polyfill-node": "^0.12.0" | ||
"rollup-plugin-node-polyfills": "^0.2.1" | ||
}, | ||
@@ -31,0 +31,0 @@ "peerDependencies": { |
@@ -1,7 +0,9 @@ | ||
import type { OnResolveArgs, Plugin } from 'esbuild' | ||
import esbuild from 'esbuild' | ||
import { OnResolveArgs, Plugin } from 'esbuild' | ||
import escapeStringRegexp from 'escape-string-regexp' | ||
import fs from 'fs' | ||
import path from 'path' | ||
import { getModules as builtinsPolyfills } from 'rollup-plugin-polyfill-node/dist/modules' | ||
import esbuild from 'esbuild' | ||
import { builtinsPolyfills } from './polyfills' | ||
// import { NodeResolvePlugin } from '@esbuild-plugins/node-resolve' | ||
const NAME = 'node-modules-polyfills' | ||
@@ -52,5 +54,9 @@ const NAMESPACE = NAME | ||
const key = removeEndingSlash(argsPath) | ||
const contents = polyfilledBuiltins.get(key) | ||
const resolveDir = path.dirname(key) | ||
const resolved = polyfilledBuiltins.get( | ||
removeEndingSlash(argsPath), | ||
) | ||
const contents = await ( | ||
await fs.promises.readFile(resolved) | ||
).toString() | ||
let resolveDir = path.dirname(resolved) | ||
@@ -57,0 +63,0 @@ if (isCommonjs) { |
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
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
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
71340
28
1181
5
+ Addedestree-walker@0.6.1(transitive)
+ Addedmagic-string@0.25.9(transitive)
+ Addedrollup-plugin-inject@3.0.2(transitive)
+ Addedrollup-plugin-node-polyfills@0.2.1(transitive)
+ Addedrollup-pluginutils@2.8.2(transitive)
+ Addedsourcemap-codec@1.4.8(transitive)
- Removedrollup-plugin-polyfill-node@^0.12.0
- Removed@jridgewell/sourcemap-codec@1.5.0(transitive)
- Removed@rollup/plugin-inject@5.0.5(transitive)
- Removed@rollup/pluginutils@5.1.0(transitive)
- Removed@types/estree@1.0.5(transitive)
- Removedestree-walker@2.0.2(transitive)
- Removedfsevents@2.3.3(transitive)
- Removedmagic-string@0.30.11(transitive)
- Removedpicomatch@2.3.1(transitive)
- Removedrollup@3.29.4(transitive)
- Removedrollup-plugin-polyfill-node@0.12.0(transitive)