Socket
Socket
Sign inDemoInstall

rollup-plugin-node-polyfills

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-node-polyfills - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

30

dist/index.js

@@ -62,3 +62,3 @@ 'use strict';

if (libs.has(importee)) {
return libs.get(importee);
return { id: libs.get(importee), moduleSideEffects: false };
}

@@ -72,7 +72,11 @@ return null;

const injectPlugin = inject({
'process': 'process',
'Buffer': ['buffer', 'Buffer'],
'global': GLOBAL_PATH,
'__filename': FILENAME_PATH,
'__dirname': DIRNAME_PATH,
include: opts.include,
exclude: opts.exclude,
modules: {
'process': 'process',
'Buffer': ['buffer', 'Buffer'],
'global': GLOBAL_PATH,
'__filename': FILENAME_PATH,
'__dirname': DIRNAME_PATH,
}
});

@@ -82,7 +86,9 @@ const basedir = opts.baseDir || '/';

const resolver = builtinsResolver(opts);
return Object.assign({}, injectPlugin, { name: 'node-polyfills', resolveId(importee, importer) {
return {
name: 'node-polyfills',
resolveId(importee, importer) {
if (importee === DIRNAME_PATH) {
const id = getRandomId();
dirs.set(id, path.dirname('/' + path.relative(basedir, importer)));
return id;
return { id, moduleSideEffects: false };
}

@@ -92,3 +98,3 @@ if (importee === FILENAME_PATH) {

dirs.set(id, path.dirname('/' + path.relative(basedir, importer)));
return id;
return { id, moduleSideEffects: false };
}

@@ -101,3 +107,7 @@ return resolver(importee);

}
} });
},
transform(code, id) {
return injectPlugin.transform.call(this, code, id);
}
};
}

@@ -104,0 +114,0 @@ function getRandomId() {

import { NodePolyfillsOptions } from './modules';
export default function (opts?: NodePolyfillsOptions): any;
export default function (opts?: NodePolyfillsOptions): {
name: string;
resolveId(importee: string, importer: string): {
id: any;
moduleSideEffects: boolean;
} | null;
load(id: string): string | undefined;
transform(code: string, id: string): any;
};

@@ -5,3 +5,8 @@ export interface NodePolyfillsOptions {

baseDir?: string;
include?: Array<string | RegExp> | string | RegExp | null;
exclude?: Array<string | RegExp> | string | RegExp | null;
}
export declare function builtinsResolver(opts: NodePolyfillsOptions): (importee: string) => any;
export declare function builtinsResolver(opts: NodePolyfillsOptions): (importee: string) => {
id: any;
moduleSideEffects: boolean;
} | null;
{
"name": "rollup-plugin-node-polyfills",
"version": "0.1.1",
"version": "0.1.2",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "module": "dist/index.mjs",

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