@mehmetb/rollup-plugin-node-builtins 3.0.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -5
- package/dist/constants.js +1 -5
- package/dist/rollup-plugin-node-builtins.cjs.js +1 -15
- package/dist/rollup-plugin-node-builtins.es6.js +1 -15
- package/package.json +1 -3
- package/src/index.js +1 -13
package/README.md
CHANGED
|
@@ -40,7 +40,6 @@ The following modules include ES6 specific version which allow you to do named i
|
|
|
40
40
|
- repl∆
|
|
41
41
|
- tls∆
|
|
42
42
|
- fs˚
|
|
43
|
-
- crypto˚
|
|
44
43
|
|
|
45
44
|
\* requires [node-globals plugin](https://github.com/calvinmetcalf/rollup-plugin-node-globals)
|
|
46
45
|
|
|
@@ -54,10 +53,6 @@ The following modules include ES6 specific version which allow you to do named i
|
|
|
54
53
|
|
|
55
54
|
˚ optional, add option to enable browserified shim
|
|
56
55
|
|
|
57
|
-
Crypto is not shimmed and and we just provide the commonjs one from browserify and it will likely not work, if you really want it please pass `{crypto: true}` as an option.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
56
|
Not all included modules rollup equally, streams (and by extension anything that requires it like http) are a mess of circular references that are pretty much impossible to tree-shake out, similarly url methods are actually a shortcut to a url object so those methods don't tree shake out very well, punycode, path, querystring, events, util, and process tree shake very well especially if you do named imports.
|
|
62
57
|
|
|
63
58
|
config for using this with something simple like events or querystring
|
package/dist/constants.js
CHANGED
|
@@ -134,8 +134,6 @@ export var UV_DIRENT_FIFO = 4;
|
|
|
134
134
|
export var UV_DIRENT_SOCKET = 5;
|
|
135
135
|
export var UV_DIRENT_CHAR = 6;
|
|
136
136
|
export var UV_DIRENT_BLOCK = 7;
|
|
137
|
-
export var EXTENSIONLESS_FORMAT_JAVASCRIPT = 0;
|
|
138
|
-
export var EXTENSIONLESS_FORMAT_WASM = 1;
|
|
139
137
|
export var S_IFMT = 61440;
|
|
140
138
|
export var S_IFREG = 32768;
|
|
141
139
|
export var S_IFDIR = 16384;
|
|
@@ -179,7 +177,7 @@ export var UV_FS_COPYFILE_FICLONE = 2;
|
|
|
179
177
|
export var COPYFILE_FICLONE = 2;
|
|
180
178
|
export var UV_FS_COPYFILE_FICLONE_FORCE = 4;
|
|
181
179
|
export var COPYFILE_FICLONE_FORCE = 4;
|
|
182
|
-
export var OPENSSL_VERSION_NUMBER =
|
|
180
|
+
export var OPENSSL_VERSION_NUMBER = 805306624;
|
|
183
181
|
export var SSL_OP_ALL = 2147485776;
|
|
184
182
|
export var SSL_OP_ALLOW_NO_DHE_KEX = 1024;
|
|
185
183
|
export var SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION = 262144;
|
|
@@ -371,8 +369,6 @@ export default {
|
|
|
371
369
|
UV_DIRENT_SOCKET: UV_DIRENT_SOCKET,
|
|
372
370
|
UV_DIRENT_CHAR: UV_DIRENT_CHAR,
|
|
373
371
|
UV_DIRENT_BLOCK: UV_DIRENT_BLOCK,
|
|
374
|
-
EXTENSIONLESS_FORMAT_JAVASCRIPT: EXTENSIONLESS_FORMAT_JAVASCRIPT,
|
|
375
|
-
EXTENSIONLESS_FORMAT_WASM: EXTENSIONLESS_FORMAT_WASM,
|
|
376
372
|
S_IFMT: S_IFMT,
|
|
377
373
|
S_IFREG: S_IFREG,
|
|
378
374
|
S_IFDIR: S_IFDIR,
|
|
@@ -32,8 +32,6 @@ libs.set('vm', require.resolve(path.join('..', 'src', 'es6', 'vm')));
|
|
|
32
32
|
libs.set('zlib', require.resolve(path.join('..', 'src', 'es6', 'zlib')));
|
|
33
33
|
libs.set('tty', require.resolve(path.join('..', 'src', 'es6', 'tty')));
|
|
34
34
|
libs.set('domain', require.resolve(path.join('..', 'src', 'es6', 'domain')));
|
|
35
|
-
var CRYPTO_PATH = require.resolve('crypto-browserify');
|
|
36
|
-
var FS_PATH = require.resolve('browserify-fs');
|
|
37
35
|
var EMPTY_PATH = require.resolve(path.join('..', 'src', 'es6', 'empty'));
|
|
38
36
|
|
|
39
37
|
// not shimmed
|
|
@@ -47,15 +45,6 @@ libs.set('readline', EMPTY_PATH);
|
|
|
47
45
|
libs.set('repl', EMPTY_PATH);
|
|
48
46
|
libs.set('tls', EMPTY_PATH);
|
|
49
47
|
function index (opts) {
|
|
50
|
-
opts = opts || {};
|
|
51
|
-
var cryptoPath = EMPTY_PATH;
|
|
52
|
-
var fsPath = EMPTY_PATH;
|
|
53
|
-
if (opts.crypto) {
|
|
54
|
-
cryptoPath = CRYPTO_PATH;
|
|
55
|
-
}
|
|
56
|
-
if (opts.fs) {
|
|
57
|
-
fsPath = FS_PATH;
|
|
58
|
-
}
|
|
59
48
|
return {
|
|
60
49
|
resolveId: function resolveId(importee) {
|
|
61
50
|
if (importee && importee.slice(-1) === '/') {
|
|
@@ -64,11 +53,8 @@ function index (opts) {
|
|
|
64
53
|
if (libs.has(importee)) {
|
|
65
54
|
return libs.get(importee);
|
|
66
55
|
}
|
|
67
|
-
if (importee === 'crypto') {
|
|
68
|
-
return cryptoPath;
|
|
69
|
-
}
|
|
70
56
|
if (importee === 'fs') {
|
|
71
|
-
|
|
57
|
+
throw new Error('The "fs" module is not supported by @mehmetb/rollup-plugin-node-builtins.');
|
|
72
58
|
}
|
|
73
59
|
}
|
|
74
60
|
};
|
|
@@ -30,8 +30,6 @@ libs.set('vm', require.resolve(join('..', 'src', 'es6', 'vm')));
|
|
|
30
30
|
libs.set('zlib', require.resolve(join('..', 'src', 'es6', 'zlib')));
|
|
31
31
|
libs.set('tty', require.resolve(join('..', 'src', 'es6', 'tty')));
|
|
32
32
|
libs.set('domain', require.resolve(join('..', 'src', 'es6', 'domain')));
|
|
33
|
-
var CRYPTO_PATH = require.resolve('crypto-browserify');
|
|
34
|
-
var FS_PATH = require.resolve('browserify-fs');
|
|
35
33
|
var EMPTY_PATH = require.resolve(join('..', 'src', 'es6', 'empty'));
|
|
36
34
|
|
|
37
35
|
// not shimmed
|
|
@@ -45,15 +43,6 @@ libs.set('readline', EMPTY_PATH);
|
|
|
45
43
|
libs.set('repl', EMPTY_PATH);
|
|
46
44
|
libs.set('tls', EMPTY_PATH);
|
|
47
45
|
function index (opts) {
|
|
48
|
-
opts = opts || {};
|
|
49
|
-
var cryptoPath = EMPTY_PATH;
|
|
50
|
-
var fsPath = EMPTY_PATH;
|
|
51
|
-
if (opts.crypto) {
|
|
52
|
-
cryptoPath = CRYPTO_PATH;
|
|
53
|
-
}
|
|
54
|
-
if (opts.fs) {
|
|
55
|
-
fsPath = FS_PATH;
|
|
56
|
-
}
|
|
57
46
|
return {
|
|
58
47
|
resolveId: function resolveId(importee) {
|
|
59
48
|
if (importee && importee.slice(-1) === '/') {
|
|
@@ -62,11 +51,8 @@ function index (opts) {
|
|
|
62
51
|
if (libs.has(importee)) {
|
|
63
52
|
return libs.get(importee);
|
|
64
53
|
}
|
|
65
|
-
if (importee === 'crypto') {
|
|
66
|
-
return cryptoPath;
|
|
67
|
-
}
|
|
68
54
|
if (importee === 'fs') {
|
|
69
|
-
|
|
55
|
+
throw new Error('The "fs" module is not supported by @mehmetb/rollup-plugin-node-builtins.');
|
|
70
56
|
}
|
|
71
57
|
}
|
|
72
58
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mehmetb/rollup-plugin-node-builtins",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "use node builtins in browser with rollup",
|
|
5
5
|
"main": "dist/rollup-plugin-node-builtins.cjs.js",
|
|
6
6
|
"jsnext:main": "dist/rollup-plugin-node-builtins.es6.js",
|
|
@@ -19,9 +19,7 @@
|
|
|
19
19
|
"author": "",
|
|
20
20
|
"license": "ISC",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"browserify-fs": "^1.0.0",
|
|
23
22
|
"buffer-es6": "^4.9.3",
|
|
24
|
-
"crypto-browserify": "^3.12.1",
|
|
25
23
|
"process-es6": "^0.11.6"
|
|
26
24
|
},
|
|
27
25
|
"devDependencies": {
|
package/src/index.js
CHANGED
|
@@ -30,8 +30,6 @@ libs.set('zlib', require.resolve(join('..', 'src', 'es6', 'zlib')));
|
|
|
30
30
|
libs.set('tty', require.resolve(join('..', 'src', 'es6', 'tty')));
|
|
31
31
|
libs.set('domain', require.resolve(join('..', 'src', 'es6', 'domain')));
|
|
32
32
|
|
|
33
|
-
const CRYPTO_PATH = require.resolve('crypto-browserify');
|
|
34
|
-
const FS_PATH = require.resolve('browserify-fs');
|
|
35
33
|
const EMPTY_PATH = require.resolve(join('..', 'src', 'es6', 'empty'));
|
|
36
34
|
|
|
37
35
|
// not shimmed
|
|
@@ -48,14 +46,7 @@ libs.set('tls', EMPTY_PATH);
|
|
|
48
46
|
|
|
49
47
|
export default function (opts) {
|
|
50
48
|
opts = opts || {};
|
|
51
|
-
let cryptoPath = EMPTY_PATH;
|
|
52
49
|
let fsPath = EMPTY_PATH;
|
|
53
|
-
if (opts.crypto) {
|
|
54
|
-
cryptoPath = CRYPTO_PATH;
|
|
55
|
-
}
|
|
56
|
-
if (opts.fs) {
|
|
57
|
-
fsPath = FS_PATH;
|
|
58
|
-
}
|
|
59
50
|
return {resolveId(importee) {
|
|
60
51
|
if (importee && importee.slice(-1) === '/') {
|
|
61
52
|
importee === importee.slice(0, -1);
|
|
@@ -63,11 +54,8 @@ export default function (opts) {
|
|
|
63
54
|
if (libs.has(importee)) {
|
|
64
55
|
return libs.get(importee);
|
|
65
56
|
}
|
|
66
|
-
if (importee === 'crypto') {
|
|
67
|
-
return cryptoPath;
|
|
68
|
-
}
|
|
69
57
|
if (importee === 'fs') {
|
|
70
|
-
|
|
58
|
+
throw new Error('The "fs" module is not supported by @mehmetb/rollup-plugin-node-builtins.');
|
|
71
59
|
}
|
|
72
60
|
}};
|
|
73
61
|
}
|