├── .npmignore
├── wrappers
├── module.js
└── crypto.js
├── .idea
├── .gitignore
├── vcs.xml
├── modules.xml
└── node-stubs.iml
├── README.md
├── CHANGELOG.md
├── .gitignore
├── LICENSE
├── scripts
└── build-deps.js
├── map.json
├── index.js
└── package.json
/.npmignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 |
--------------------------------------------------------------------------------
/wrappers/module.js:
--------------------------------------------------------------------------------
1 | module.exports = module.constructor;
2 |
--------------------------------------------------------------------------------
/wrappers/crypto.js:
--------------------------------------------------------------------------------
1 | global.Buffer = global.Buffer || require("buffer").Buffer;
2 | module.exports = require("crypto-browserify");
3 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Editor-based HTTP Client requests
5 | /httpRequests/
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # node-stubs
2 | Stub implementations of Node built-in modules, a la Browserify
3 |
4 | THIS REPOSITORY HAS BEEN [MERGED INTO THE MAIN METEOR REPOSITORY](https://github.com/meteor/meteor/tree/devel/npm-packages/meteor-node-stubs). You will find the up to date code there.
5 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/node-stubs.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | v1.1.0 - 2021-07-19
2 |
3 | * Updated dependencies to their latest versions
4 | - `assert@2.0.0`
5 | - `buffer@6.0.3`
6 | - `console-browserify@1.2.0`
7 | - `domain-browser@4.19.0`
8 | - `events@3.3.0`
9 | - `readable-stream@3.6.0`
10 | - `stream-browserify@3.0.0`
11 | - `stream-http@3.2.0`
12 | - `string_decoder@1.3.0`
13 | - `timers-browserify@2.0.12`
14 | - `util@0.12.4`
15 | - `vm-browserify@1.1.2`
16 |
17 | v1.0.3 - 2021-03-25
18 |
19 | * Add elliptic@6.5.4 as a direct dependency to force upgrade due to a security vulnerability. It was not possible to upgrade indirectly as [crypto-browserify]( https://www.npmjs.com/package/crypto-browserify) is not updated.
20 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 |
6 | # Runtime data
7 | pids
8 | *.pid
9 | *.seed
10 |
11 | # Directory for instrumented libs generated by jscoverage/JSCover
12 | lib-cov
13 |
14 | # Coverage directory used by tools like istanbul
15 | coverage
16 |
17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
18 | .grunt
19 |
20 | # node-waf configuration
21 | .lock-wscript
22 |
23 | # Compiled binary addons (http://nodejs.org/api/addons.html)
24 | build/Release
25 |
26 | # Dependency directory
27 | node_modules
28 |
29 | # Optional npm cache directory
30 | .npm
31 |
32 | # Optional REPL history
33 | .node_repl_history
34 |
35 | # Output directory for npm install script build-deps.js.
36 | deps
37 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Ben Newman
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/scripts/build-deps.js:
--------------------------------------------------------------------------------
1 | var fs = require("fs");
2 | var path = require("path");
3 | var depsDir = path.join(__dirname, "..", "deps");
4 | var map = require("../map.json");
5 |
6 | // Each file in the `deps` directory expresses the dependencies of a stub.
7 | // For example, `deps/http.js` calls `require("http-browserify")` to
8 | // indicate that the `http` stub depends on the `http-browserify` package.
9 | // This makes it easy for a bundling tool like Browserify, Webpack, or
10 | // Meteor to include the appropriate package dependencies by depending on
11 | // `meteor-node-stubs/deps/http` rather than having to know how the `http`
12 | // stub is implemented. Some modules in the `deps` directory are empty,
13 | // such as `deps/fs.js`, which indicates that no dependencies need to be
14 | // bundled. Note that these modules should not be `require`d at runtime,
15 | // but merely scanned at bundling time.
16 |
17 | fs.mkdir(depsDir, function () {
18 | require("rimraf")("deps/*.js", function (error) {
19 | if (error) throw error;
20 | Object.keys(map).forEach(function (id) {
21 | fs.writeFileSync(
22 | path.join(depsDir, id + ".js"),
23 | typeof map[id] === "string"
24 | ? "require(" + JSON.stringify(map[id]) + ");\n"
25 | : ""
26 | );
27 | });
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/map.json:
--------------------------------------------------------------------------------
1 | {
2 | "assert": "assert/",
3 | "buffer": "buffer/",
4 | "child_process": null,
5 | "cluster": null,
6 | "console": "console-browserify",
7 | "constants": "constants-browserify",
8 | "crypto": "../wrappers/crypto.js",
9 | "dgram": null,
10 | "dns": null,
11 | "domain": "domain-browser",
12 | "events": "events/",
13 | "fs": null,
14 | "http": "stream-http",
15 | "https": "https-browserify",
16 | "module": "../wrappers/module.js",
17 | "net": null,
18 | "os": "os-browserify/browser.js",
19 | "path": "path-browserify",
20 | "process": "process/browser.js",
21 | "punycode": "punycode/",
22 | "querystring": "querystring-es3/",
23 | "readline": null,
24 | "repl": null,
25 | "stream": "stream-browserify",
26 | "_stream_duplex": "readable-stream/lib/_stream_duplex.js",
27 | "_stream_passthrough": "readable-stream/lib/_stream_passthrough.js",
28 | "_stream_readable": "readable-stream/lib/_stream_readable.js",
29 | "_stream_transform": "readable-stream/lib/_stream_transform.js",
30 | "_stream_writable": "readable-stream/lib/_stream_writable.js",
31 | "string_decoder": "string_decoder/",
32 | "sys": "util/util.js",
33 | "timers": "timers-browserify",
34 | "tls": null,
35 | "tty": "tty-browserify",
36 | "url": "url/",
37 | "util": "util/util.js",
38 | "vm": "vm-browserify",
39 | "zlib": "browserify-zlib"
40 | }
41 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | var map = require("./map.json");
2 | var meteorAliases = {};
3 |
4 | Object.keys(map).forEach(function (id) {
5 | if (typeof map[id] === "string") {
6 | var aliasParts = module.id.split("/");
7 | aliasParts.pop();
8 | aliasParts.push("node_modules", map[id]);
9 | exports[id] = meteorAliases[id + ".js"] =
10 | aliasParts.join("/");
11 | } else {
12 | exports[id] = map[id];
13 | meteorAliases[id + ".js"] = function(){};
14 | }
15 | });
16 |
17 | if (typeof meteorInstall === "function") {
18 | meteorInstall({
19 | // Install the aliases into a node_modules directory one level up from
20 | // the root directory, so that they do not clutter the namespace
21 | // available to apps and packages.
22 | "..": {
23 | node_modules: meteorAliases
24 | }
25 | });
26 | }
27 |
28 | // If Buffer is not defined globally, but the "buffer" built-in stub is
29 | // installed and can be imported, use it to define global.Buffer so that
30 | // modules like core-util-is/lib/util.js can refer to Buffer without
31 | // crashing application startup.
32 | if (typeof global.Buffer !== "function") {
33 | try {
34 | // Use (0, require)(...) to avoid registering a dependency on the
35 | // "buffer" stub, in case it is not otherwise bundled.
36 | global.Buffer = (0, require)("buffer").Buffer;
37 | } catch (ok) {
38 | // Failure to import "buffer" is fine as long as the Buffer global
39 | // variable is not used.
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "meteor-node-stubs",
3 | "author": "Ben Newman ",
4 | "description": "Stub implementations of Node built-in modules, a la Browserify",
5 | "version": "1.1.0",
6 | "main": "index.js",
7 | "license": "MIT",
8 | "scripts": {
9 | "prepare": "node scripts/build-deps.js"
10 | },
11 | "dependencies": {
12 | "assert": "^2.0.0",
13 | "browserify-zlib": "^0.2.0",
14 | "buffer": "^6.0.3",
15 | "console-browserify": "^1.2.0",
16 | "constants-browserify": "^1.0.0",
17 | "crypto-browserify": "^3.12.0",
18 | "domain-browser": "^4.19.0",
19 | "elliptic": "^6.5.4",
20 | "events": "^3.3.0",
21 | "https-browserify": "^1.0.0",
22 | "os-browserify": "^0.3.0",
23 | "path-browserify": "^1.0.0",
24 | "process": "^0.11.10",
25 | "punycode": "^2.1.1",
26 | "querystring-es3": "^0.2.1",
27 | "readable-stream": "^3.6.0",
28 | "stream-browserify": "^3.0.0",
29 | "stream-http": "^3.2.0",
30 | "string_decoder": "^1.3.0",
31 | "timers-browserify": "^2.0.12",
32 | "tty-browserify": "0.0.1",
33 | "url": "^0.11.0",
34 | "util": "^0.12.4",
35 | "vm-browserify": "^1.1.2"
36 | },
37 | "bundledDependencies": [
38 | "assert",
39 | "browserify-zlib",
40 | "buffer",
41 | "console-browserify",
42 | "constants-browserify",
43 | "crypto-browserify",
44 | "domain-browser",
45 | "events",
46 | "https-browserify",
47 | "os-browserify",
48 | "path-browserify",
49 | "process",
50 | "punycode",
51 | "querystring-es3",
52 | "readable-stream",
53 | "stream-browserify",
54 | "stream-http",
55 | "string_decoder",
56 | "timers-browserify",
57 | "tty-browserify",
58 | "url",
59 | "util",
60 | "vm-browserify"
61 | ],
62 | "devDependencies": {
63 | "rimraf": "^2.5.2"
64 | },
65 | "repository": {
66 | "type": "git",
67 | "url": "git+https://github.com/meteor/node-stubs.git"
68 | },
69 | "keywords": [
70 | "stubs",
71 | "shims",
72 | "node",
73 | "builtins",
74 | "core",
75 | "modules",
76 | "browserify",
77 | "webpack",
78 | "meteor"
79 | ],
80 | "bugs": {
81 | "url": "https://github.com/meteor/node-stubs/issues"
82 | },
83 | "homepage": "https://github.com/meteor/node-stubs#readme"
84 | }
85 |
--------------------------------------------------------------------------------