Skip to content
This repository was archived by the owner on May 23, 2021. It is now read-only.

Commit 98deffa

Browse files
committed
Update to v10.15.1
1 parent b4c31c8 commit 98deffa

File tree

8 files changed

+94
-85
lines changed

8 files changed

+94
-85
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
node_js:
3-
- 8.15.0
3+
- 10.15.1
44
cache:
55
directories:
66
- /home/travis/.ccache/

lib/node

Submodule node updated 19599 files

node.patch

Lines changed: 82 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,136 @@
1-
diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js
2-
index 0e9c36c4fc..66367e51ce 100644
3-
--- a/lib/internal/bootstrap_node.js
4-
+++ b/lib/internal/bootstrap_node.js
5-
@@ -118,13 +118,16 @@
6-
'ExperimentalWarning', undefined);
7-
}
8-
9-
+ if (NativeModule.exists('_third_party_main')) {
10-
+ NativeModule.require('_third_party_main');
11-
+ }
12-
13-
// There are various modes that Node can run in. The most common two
1+
diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js
2+
index 885546c5d6..f1287bb191 100644
3+
--- a/lib/internal/bootstrap/node.js
4+
+++ b/lib/internal/bootstrap/node.js
5+
@@ -215,11 +215,16 @@
146
// are running from a script and running the REPL - but there are a few
157
// others like the debugger or running --eval arguments. Here we decide
16-
// which mode we run in.
17-
18-
- if (NativeModule.exists('_third_party_main')) {
19-
+ if (NativeModule.exists('_third_party_main_invalid')) {
8+
// which mode we run in.
9+
+
10+
+ if (NativeModule.exists('_third_party_main')) {
11+
+ NativeModule.require('_third_party_main');
12+
+ }
13+
+
14+
if (internalBinding('worker').getEnvMessagePort() !== undefined) {
15+
// This means we are in a Worker context, and any script execution
16+
// will be directed by the worker module.
17+
NativeModule.require('internal/worker').setupChild(evalScript);
18+
- } else if (NativeModule.exists('_third_party_main')) {
19+
+ } else if (NativeModule.exists('_third_party_main_invalid')) {
2020
// To allow people to extend Node in different ways, this hook allows
2121
// one to drop a file lib/_third_party_main.js into the build
2222
// directory which will be executed instead of Node's normal loading.
23-
diff --git a/lib/module.js b/lib/module.js
24-
index 642e5cb1f1..3d298fbf01 100644
25-
--- a/lib/module.js
26-
+++ b/lib/module.js
27-
@@ -36,6 +36,9 @@ const {
28-
} = process.binding('fs');
29-
const preserveSymlinks = !!process.binding('config').preserveSymlinks;
30-
const experimentalModules = !!process.binding('config').experimentalModules;
23+
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
24+
index fb3770b729..eb65385afe 100644
25+
--- a/lib/internal/modules/cjs/loader.js
26+
+++ b/lib/internal/modules/cjs/loader.js
27+
@@ -44,6 +44,9 @@ const { getOptionValue } = require('internal/options');
28+
const preserveSymlinks = getOptionValue('--preserve-symlinks');
29+
const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main');
30+
const experimentalModules = getOptionValue('--experimental-modules');
3131
+const nbin = require('nbin');
3232
+const os = require('os');
3333
+const zlib = require('zlib');
3434

35-
const errors = require('internal/errors');
36-
37-
@@ -54,7 +57,8 @@ function stat(filename) {
35+
const {
36+
ERR_INVALID_ARG_TYPE,
37+
@@ -87,7 +90,8 @@ function stat(filename) {
3838
const result = cache.get(filename);
3939
if (result !== undefined) return result;
4040
}
4141
- const result = internalModuleStat(filename);
42-
+ const s = nbin.statSync(filename);
43-
+ const result = s.isDirectory ? 1 : s.isFile ? 0 : internalModuleStat(filename);
42+
+ const s = nbin.statSync(filename);
43+
+ const result = s.isDirectory ? 1 : s.isFile ? 0 : internalModuleStat(filename);
4444
if (cache !== null) cache.set(filename, result);
4545
return result;
4646
}
47-
@@ -115,8 +119,13 @@ function readPackage(requestPath) {
47+
@@ -154,8 +158,13 @@ function readPackage(requestPath) {
4848
if (entry)
4949
return entry;
5050

51-
+ let json;
51+
+ let json;
5252
const jsonPath = path.resolve(requestPath, 'package.json');
53-
- const json = internalModuleReadFile(path._makeLong(jsonPath));
54-
+ if (nbin.existsSync(jsonPath)) {
55-
+ json = nbin.readFileSync(jsonPath, 'utf8');
56-
+ } else {
57-
+ json = internalModuleReadFile(path._makeLong(jsonPath));
58-
+ }
53+
- const json = internalModuleReadJSON(path.toNamespacedPath(jsonPath));
54+
+ if (nbin.existsSync(jsonPath)) {
55+
+ json = nbin.readFileSync(jsonPath, 'utf8');
56+
+ } else {
57+
+ json = internalModuleReadJSON(path.toNamespacedPath(jsonPath));
58+
+ }
5959

6060
if (json === undefined) {
6161
return false;
62-
@@ -161,6 +170,9 @@ function tryFile(requestPath, isMain) {
62+
@@ -199,6 +208,9 @@ function tryFile(requestPath, isMain) {
6363
}
6464

6565
function toRealPath(requestPath) {
66-
+ if (nbin.existsSync(requestPath)) {
67-
+ return requestPath;
68-
+ }
66+
+ if (nbin.existsSync(requestPath)) {
67+
+ return requestPath;
68+
+ }
6969
return fs.realpathSync(requestPath, {
7070
[internalFS.realpathCacheKey]: realpathCache
7171
});
72-
@@ -660,14 +672,29 @@ Module.prototype._compile = function(content, filename) {
72+
@@ -696,14 +708,29 @@ Module.prototype._compile = function(content, filename) {
7373

7474
// Native extension for .js
7575
Module._extensions['.js'] = function(module, filename) {
7676
- var content = fs.readFileSync(filename, 'utf8');
77-
+ let content;
78-
+ if (nbin.existsSync(filename)) {
79-
+ content = nbin.readFileSync(filename, 'utf8');
80-
+ } else {
81-
+ content = fs.readFileSync(filename, 'utf8');
82-
+ }
83-
module._compile(internalModule.stripBOM(content), filename);
77+
+ let content;
78+
+ if (nbin.existsSync(filename)) {
79+
+ content = nbin.readFileSync(filename, 'utf8');
80+
+ } else {
81+
+ content = fs.readFileSync(filename, 'utf8');
82+
+ }
83+
module._compile(stripBOM(content), filename);
8484
};
8585

8686
+// Native extension for .gz
8787
+Module._extensions['.gz'] = function(module, filename) {
88-
+ const content = zlib.gunzipSync(nbin.readFileSync(filename)).toString("utf8");
89-
+ module._compile(internalModule.stripBOM(content), filename);
88+
+ const content = zlib.gunzipSync(nbin.readFileSync(filename)).toString("utf8");
89+
+ module._compile(stripBOM(content), filename);
9090
+};
9191

9292
// Native extension for .json
9393
Module._extensions['.json'] = function(module, filename) {
9494
- var content = fs.readFileSync(filename, 'utf8');
95-
+ let content;
96-
+ if (nbin.existsSync(filename)) {
97-
+ content = nbin.readFileSync(filename, 'utf8');
98-
+ } else {
99-
+ content = fs.readFileSync(filename, 'utf8');
100-
+ }
95+
+ let content;
96+
+ if (nbin.existsSync(filename)) {
97+
+ content = nbin.readFileSync(filename, 'utf8');
98+
+ } else {
99+
+ content = fs.readFileSync(filename, 'utf8');
100+
+ }
101101
try {
102-
module.exports = JSON.parse(internalModule.stripBOM(content));
102+
module.exports = JSON.parse(stripBOM(content));
103103
} catch (err) {
104-
@@ -679,6 +706,11 @@ Module._extensions['.json'] = function(module, filename) {
104+
@@ -715,7 +742,14 @@ Module._extensions['.json'] = function(module, filename) {
105105

106-
//Native extension for .node
106+
// Native extension for .node
107107
Module._extensions['.node'] = function(module, filename) {
108-
+ if (nbin.existsSync(filename)) {
109-
+ const tmpFile = path.join(os.tmpdir(), `.nbin-${path.basename(filename)}`);
110-
+ fs.writeFileSync(tmpFile, nbin.readFileSync(filename));
111-
+ filename = tmpFile;
112-
+ }
113-
return process.dlopen(module, path._makeLong(filename));
108+
- return process.dlopen(module, path.toNamespacedPath(filename));
109+
+ let isInternal = false;
110+
+ if (nbin.existsSync(filename)) {
111+
+ const tmpFile = path.join(os.tmpdir(), `.nbin-${path.basename(filename)}`);
112+
+ fs.writeFileSync(tmpFile, nbin.readFileSync(filename));
113+
+ filename = tmpFile;
114+
+ isInternal = true;
115+
+ }
116+
+ return process.dlopen(module, isInternal ? filename : path.toNamespacedPath(filename));
114117
};
115118

119+
if (experimentalModules) {
116120
diff --git a/src/node.cc b/src/node.cc
117-
index 3d791f04ad..d6ae74884c 100644
121+
index 9fb5ab3b8e..d2c9ab3bc3 100644
118122
--- a/src/node.cc
119123
+++ b/src/node.cc
120-
@@ -3813,6 +3813,11 @@ void ProcessArgv(int* argc,
121-
int* exec_argc,
122-
const char*** exec_argv,
123-
bool is_env = false) {
124+
@@ -2439,6 +2439,12 @@ void ProcessArgv(std::vector<std::string>* args,
125+
std::vector<std::string> v8_args;
126+
std::vector<std::string> errors{};
127+
124128
+ if (!getenv("NBIN_BYPASS") && !is_env) {
125-
+ *exec_argc = 0;
129+
+ // *exec_argc = 0;
126130
+
127-
+ return;
131+
+ return;
128132
+ }
129-
// Parse a few arguments which are specific to Node.
130-
int v8_argc;
131-
const char** v8_argv;
133+
+
134+
{
135+
// TODO(addaleax): The mutex here should ideally be held during the
136+
// entire function, but that doesn't play well with the exit() calls below.

scripts/patch_gen.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
cd "$(dirname "$0")"
44
cd ../lib/node
5-
git diff -w -- lib/module.js lib/internal/bootstrap_node.js src/node.cc --unified=0 > ../../node.patch
5+
git diff -w -- lib/internal/modules/cjs/loader.js lib/internal/bootstrap/node.js src/node.cc --unified=0 > ../../node.patch

scripts/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
cd "$(dirname "$0")"
44
cd ..
5-
rm lib/node/test/fixtures/packages/invalid/package.json
5+
rm lib/node/test/fixtures/packages/unparseable/package.json
66
npm run test

scripts/vars.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
cd "$(dirname "$0")"
4-
NODE_VERSION=8.15.0
4+
NODE_VERSION=10.15.1
55
PACKAGE_VERSION=$(cat ../package.json \
66
| grep version \
77
| head -1 \

src/api/bundler.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,13 @@ if (process.platform === "linux") {
4444
mainFile,
4545
});
4646
bin.writeModule(path.join(__dirname, "../../node_modules", "node-pty"));
47-
bin.writeFile(mainFile, Buffer.from(`require("node-pty");`));
47+
bin.writeFile(mainFile, Buffer.from(`require("node-pty");console.log("hi");`));
4848
const resp = await runBinary(bin);
49-
expect(resp.stderr.toString().trim().length).toEqual(0);
49+
const stderr = resp.stderr.toString().trim();
50+
if (stderr.length > 0) {
51+
console.error(stderr);
52+
}
53+
expect(stderr.length).toEqual(0);
5054
});
5155
}
5256

src/api/bundler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export class Binary implements nbin.Binary {
163163
if (currentArchitecture === "x64") {
164164
currentArchitecture = "x86_64";
165165
}
166-
const nodeVersion = "8.15.0";
166+
const nodeVersion = "10.15.1";
167167
const packageJson = require("../../package.json");
168168
const packageVersion = packageJson.version;
169169
const binName = `${packageVersion}/node-${nodeVersion}-${currentPlatform}-${currentArchitecture}`;

0 commit comments

Comments
 (0)