node-pty 1.2.0-beta.1 → 1.2.0-beta.2
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/binding.gyp +56 -0
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/pty.node +0 -0
- package/prebuilds/darwin-arm64/spawn-helper +0 -0
- package/prebuilds/darwin-x64/pty.node +0 -0
- package/prebuilds/darwin-x64/spawn-helper +0 -0
- package/prebuilds/linux-arm64/pty.node +0 -0
- package/prebuilds/linux-x64/pty.node +0 -0
- package/prebuilds/win32-arm64/conpty.node +0 -0
- package/prebuilds/win32-arm64/conpty.pdb +0 -0
- package/prebuilds/win32-arm64/conpty_console_list.node +0 -0
- package/prebuilds/win32-arm64/conpty_console_list.pdb +0 -0
- package/prebuilds/win32-arm64/pty.node +0 -0
- package/prebuilds/win32-arm64/pty.pdb +0 -0
- package/prebuilds/win32-arm64/winpty-agent.exe +0 -0
- package/prebuilds/win32-arm64/winpty-agent.pdb +0 -0
- package/prebuilds/win32-arm64/winpty.dll +0 -0
- package/prebuilds/win32-arm64/winpty.pdb +0 -0
- package/prebuilds/win32-x64/conpty.node +0 -0
- package/prebuilds/win32-x64/conpty.pdb +0 -0
- package/prebuilds/win32-x64/conpty_console_list.node +0 -0
- package/prebuilds/win32-x64/conpty_console_list.pdb +0 -0
- package/prebuilds/win32-x64/pty.node +0 -0
- package/prebuilds/win32-x64/pty.pdb +0 -0
- package/prebuilds/win32-x64/winpty-agent.exe +0 -0
- package/prebuilds/win32-x64/winpty-agent.pdb +0 -0
- package/prebuilds/win32-x64/winpty.dll +0 -0
- package/prebuilds/win32-x64/winpty.pdb +0 -0
- package/scripts/linux/checksums.txt +2 -0
- package/scripts/linux/install-sysroot.js +157 -0
- package/scripts/linux/verify-glibc-requirements.sh +36 -0
- package/scripts/prebuild.js +8 -0
package/binding.gyp
CHANGED
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
'-lutil'
|
|
81
81
|
],
|
|
82
82
|
'cflags': ['-Wall', '-O2', '-D_FORTIFY_SOURCE=2'],
|
|
83
|
+
'ldflags': [],
|
|
83
84
|
'conditions': [
|
|
84
85
|
# http://www.gnu.org/software/gnulib/manual/html_node/forkpty.html
|
|
85
86
|
# One some systems (at least including Cygwin, Interix,
|
|
@@ -88,6 +89,61 @@
|
|
|
88
89
|
'libraries!': [
|
|
89
90
|
'-lutil'
|
|
90
91
|
]
|
|
92
|
+
}],
|
|
93
|
+
['OS=="linux"', {
|
|
94
|
+
'variables': {
|
|
95
|
+
'sysroot%': '<!(node -p "process.env.SYSROOT_PATH || \'\'")',
|
|
96
|
+
'target_arch%': '<!(node -p "process.env.npm_config_arch || process.arch")',
|
|
97
|
+
},
|
|
98
|
+
'conditions': [
|
|
99
|
+
['sysroot!=""', {
|
|
100
|
+
'variables': {
|
|
101
|
+
'gcc_include%': '<!(${CXX:-g++} -print-file-name=include)',
|
|
102
|
+
},
|
|
103
|
+
'conditions': [
|
|
104
|
+
['target_arch=="x64"', {
|
|
105
|
+
'cflags': [
|
|
106
|
+
'--sysroot=<(sysroot)',
|
|
107
|
+
'-nostdinc',
|
|
108
|
+
'-isystem<(gcc_include)',
|
|
109
|
+
'-isystem<(sysroot)/usr/include',
|
|
110
|
+
'-isystem<(sysroot)/usr/include/x86_64-linux-gnu'
|
|
111
|
+
],
|
|
112
|
+
'cflags_cc': [
|
|
113
|
+
'-nostdinc++',
|
|
114
|
+
'-isystem<(sysroot)/../include/c++/10.5.0',
|
|
115
|
+
'-isystem<(sysroot)/../include/c++/10.5.0/x86_64-linux-gnu',
|
|
116
|
+
'-isystem<(sysroot)/../include/c++/10.5.0/backward'
|
|
117
|
+
],
|
|
118
|
+
'ldflags': [
|
|
119
|
+
'--sysroot=<(sysroot)',
|
|
120
|
+
'-L<(sysroot)/lib',
|
|
121
|
+
'-L<(sysroot)/usr/lib'
|
|
122
|
+
],
|
|
123
|
+
}],
|
|
124
|
+
['target_arch=="arm64"', {
|
|
125
|
+
'cflags': [
|
|
126
|
+
'--sysroot=<(sysroot)',
|
|
127
|
+
'-nostdinc',
|
|
128
|
+
'-isystem<(gcc_include)',
|
|
129
|
+
'-isystem<(sysroot)/usr/include',
|
|
130
|
+
'-isystem<(sysroot)/usr/include/aarch64-linux-gnu'
|
|
131
|
+
],
|
|
132
|
+
'cflags_cc': [
|
|
133
|
+
'-nostdinc++',
|
|
134
|
+
'-isystem<(sysroot)/../include/c++/10.5.0',
|
|
135
|
+
'-isystem<(sysroot)/../include/c++/10.5.0/aarch64-linux-gnu',
|
|
136
|
+
'-isystem<(sysroot)/../include/c++/10.5.0/backward'
|
|
137
|
+
],
|
|
138
|
+
'ldflags': [
|
|
139
|
+
'--sysroot=<(sysroot)',
|
|
140
|
+
'-L<(sysroot)/lib',
|
|
141
|
+
'-L<(sysroot)/usr/lib'
|
|
142
|
+
],
|
|
143
|
+
}]
|
|
144
|
+
]
|
|
145
|
+
}]
|
|
146
|
+
]
|
|
91
147
|
}]
|
|
92
148
|
]
|
|
93
149
|
}
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
|
|
6
|
+
const { execSync } = require('child_process');
|
|
7
|
+
const { tmpdir } = require('os');
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const { createHash } = require('crypto');
|
|
11
|
+
|
|
12
|
+
const REPO_ROOT = path.join(__dirname, '..', '..');
|
|
13
|
+
|
|
14
|
+
const ghApiHeaders = {
|
|
15
|
+
Accept: 'application/vnd.github.v3+json',
|
|
16
|
+
'User-Agent': 'node-pty Build',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
if (process.env.GITHUB_TOKEN) {
|
|
20
|
+
ghApiHeaders.Authorization = 'Basic ' + Buffer.from(process.env.GITHUB_TOKEN).toString('base64');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const ghDownloadHeaders = {
|
|
24
|
+
...ghApiHeaders,
|
|
25
|
+
Accept: 'application/octet-stream',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function getSysrootChecksum(expectedName) {
|
|
29
|
+
const checksumPath = path.join(REPO_ROOT, 'scripts', 'linux', 'checksums.txt');
|
|
30
|
+
const checksums = fs.readFileSync(checksumPath, 'utf8');
|
|
31
|
+
for (const line of checksums.split('\n')) {
|
|
32
|
+
const [checksum, name] = line.split(/\s+/);
|
|
33
|
+
if (name === expectedName) {
|
|
34
|
+
return checksum;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function fetchUrl(options, retries = 10, retryDelay = 1000) {
|
|
41
|
+
try {
|
|
42
|
+
const controller = new AbortController();
|
|
43
|
+
const timeout = setTimeout(() => controller.abort(), 30 * 1000);
|
|
44
|
+
const version = '20250407-330404';
|
|
45
|
+
try {
|
|
46
|
+
const response = await fetch(`https://api.github.com/repos/Microsoft/vscode-linux-build-agent/releases/tags/v${version}`, {
|
|
47
|
+
headers: ghApiHeaders,
|
|
48
|
+
signal: controller.signal
|
|
49
|
+
});
|
|
50
|
+
if (response.ok && (response.status >= 200 && response.status < 300)) {
|
|
51
|
+
console.log(`Fetch completed: Status ${response.status}.`);
|
|
52
|
+
const contents = Buffer.from(await response.arrayBuffer());
|
|
53
|
+
const asset = JSON.parse(contents.toString()).assets.find((a) => a.name === options.assetName);
|
|
54
|
+
if (!asset) {
|
|
55
|
+
throw new Error(`Could not find asset in release of Microsoft/vscode-linux-build-agent @ ${version}`);
|
|
56
|
+
}
|
|
57
|
+
console.log(`Found asset ${options.assetName} @ ${asset.url}.`);
|
|
58
|
+
const assetResponse = await fetch(asset.url, {
|
|
59
|
+
headers: ghDownloadHeaders
|
|
60
|
+
});
|
|
61
|
+
if (assetResponse.ok && (assetResponse.status >= 200 && assetResponse.status < 300)) {
|
|
62
|
+
const assetContents = Buffer.from(await assetResponse.arrayBuffer());
|
|
63
|
+
console.log(`Fetched response body buffer: ${assetContents.byteLength} bytes`);
|
|
64
|
+
if (options.checksumSha256) {
|
|
65
|
+
const actualSHA256Checksum = createHash('sha256').update(assetContents).digest('hex');
|
|
66
|
+
if (actualSHA256Checksum !== options.checksumSha256) {
|
|
67
|
+
throw new Error(`Checksum mismatch for ${asset.url} (expected ${options.checksumSha256}, actual ${actualSHA256Checksum})`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
console.log(`Verified SHA256 checksums match for ${asset.url}`);
|
|
71
|
+
const tarCommand = `tar -xz -C ${options.dest}`;
|
|
72
|
+
execSync(tarCommand, { input: assetContents });
|
|
73
|
+
console.log(`Fetch complete!`);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
throw new Error(`Request ${asset.url} failed with status code: ${assetResponse.status}`);
|
|
77
|
+
}
|
|
78
|
+
throw new Error(`Request https://api.github.com failed with status code: ${response.status}`);
|
|
79
|
+
} finally {
|
|
80
|
+
clearTimeout(timeout);
|
|
81
|
+
}
|
|
82
|
+
} catch (e) {
|
|
83
|
+
if (retries > 0) {
|
|
84
|
+
console.log(`Fetching failed: ${e}`);
|
|
85
|
+
await new Promise(resolve => setTimeout(resolve, retryDelay));
|
|
86
|
+
return fetchUrl(options, retries - 1, retryDelay);
|
|
87
|
+
}
|
|
88
|
+
throw e;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async function getSysroot(arch) {
|
|
93
|
+
let expectedName;
|
|
94
|
+
let triple;
|
|
95
|
+
const prefix = '-glibc-2.28-gcc-10.5.0';
|
|
96
|
+
|
|
97
|
+
switch (arch) {
|
|
98
|
+
case 'x64':
|
|
99
|
+
expectedName = `x86_64-linux-gnu${prefix}.tar.gz`;
|
|
100
|
+
triple = 'x86_64-linux-gnu';
|
|
101
|
+
break;
|
|
102
|
+
case 'arm64':
|
|
103
|
+
expectedName = `aarch64-linux-gnu${prefix}.tar.gz`;
|
|
104
|
+
triple = 'aarch64-linux-gnu';
|
|
105
|
+
break;
|
|
106
|
+
default:
|
|
107
|
+
throw new Error(`Unsupported architecture: ${arch}`);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
console.log(`Fetching ${expectedName} for ${triple}`);
|
|
111
|
+
const checksumSha256 = getSysrootChecksum(expectedName);
|
|
112
|
+
if (!checksumSha256) {
|
|
113
|
+
throw new Error(`Could not find checksum for ${expectedName}`);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const sysroot = path.join(tmpdir(), `vscode-${arch}-sysroot`);
|
|
117
|
+
const stamp = path.join(sysroot, '.stamp');
|
|
118
|
+
const result = `${sysroot}/${triple}/${triple}/sysroot`;
|
|
119
|
+
|
|
120
|
+
if (fs.existsSync(stamp) && fs.readFileSync(stamp).toString() === expectedName) {
|
|
121
|
+
console.log(`Sysroot already installed: ${result}`);
|
|
122
|
+
return result;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
console.log(`Installing ${arch} root image: ${sysroot}`);
|
|
126
|
+
fs.rmSync(sysroot, { recursive: true, force: true });
|
|
127
|
+
fs.mkdirSync(sysroot, { recursive: true });
|
|
128
|
+
|
|
129
|
+
await fetchUrl({
|
|
130
|
+
checksumSha256,
|
|
131
|
+
assetName: expectedName,
|
|
132
|
+
dest: sysroot
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
fs.writeFileSync(stamp, expectedName);
|
|
136
|
+
console.log(`Sysroot installed: ${result}`);
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async function main() {
|
|
141
|
+
const arch = process.argv[2] || process.env.ARCH || 'x64';
|
|
142
|
+
console.log(`Installing sysroot for architecture: ${arch}`);
|
|
143
|
+
|
|
144
|
+
try {
|
|
145
|
+
const sysrootPath = await getSysroot(arch);
|
|
146
|
+
console.log(`SYSROOT_PATH=${sysrootPath}`);
|
|
147
|
+
} catch (error) {
|
|
148
|
+
console.error('Error installing sysroot:', error);
|
|
149
|
+
process.exit(1);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (require.main === module) {
|
|
154
|
+
main();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
module.exports = { getSysroot };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -e
|
|
4
|
+
|
|
5
|
+
# Get all files with .node extension from given folder
|
|
6
|
+
files=$(find $SEARCH_PATH -name "*.node")
|
|
7
|
+
|
|
8
|
+
echo "Verifying requirements for files: $files"
|
|
9
|
+
|
|
10
|
+
for file in $files; do
|
|
11
|
+
glibc_version="$EXPECTED_GLIBC_VERSION"
|
|
12
|
+
glibcxx_version="$EXPECTED_GLIBCXX_VERSION"
|
|
13
|
+
while IFS= read -r line; do
|
|
14
|
+
if [[ $line == *"GLIBC_"* ]]; then
|
|
15
|
+
version=$(echo "$line" | awk '{if ($5 ~ /^[0-9a-fA-F]+$/) print $6; else print $5}' | tr -d '()')
|
|
16
|
+
version=${version#*_}
|
|
17
|
+
if [[ $(printf "%s\n%s" "$version" "$glibc_version" | sort -V | tail -n1) == "$version" ]]; then
|
|
18
|
+
glibc_version=$version
|
|
19
|
+
fi
|
|
20
|
+
elif [[ $line == *"GLIBCXX_"* ]]; then
|
|
21
|
+
version=$(echo "$line" | awk '{if ($5 ~ /^[0-9a-fA-F]+$/) print $6; else print $5}' | tr -d '()')
|
|
22
|
+
version=${version#*_}
|
|
23
|
+
if [[ $(printf "%s\n%s" "$version" "$glibcxx_version" | sort -V | tail -n1) == "$version" ]]; then
|
|
24
|
+
glibcxx_version=$version
|
|
25
|
+
fi
|
|
26
|
+
fi
|
|
27
|
+
done < <("$SYSROOT_PATH/../bin/objdump" -T "$file")
|
|
28
|
+
|
|
29
|
+
if [[ "$glibc_version" != "$EXPECTED_GLIBC_VERSION" ]]; then
|
|
30
|
+
echo "Error: File $file has dependency on GLIBC > $EXPECTED_GLIBC_VERSION, found $glibc_version"
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
if [[ "$glibcxx_version" != "$EXPECTED_GLIBCXX_VERSION" ]]; then
|
|
34
|
+
echo "Error: File $file has dependency on GLIBCXX > $EXPECTED_GLIBCXX_VERSION, found $glibcxx_version"
|
|
35
|
+
fi
|
|
36
|
+
done
|
package/scripts/prebuild.js
CHANGED
|
@@ -31,4 +31,12 @@ if (!fs.existsSync(PREBUILD_DIR)) {
|
|
|
31
31
|
process.exit(1);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
// Ensure spawn-helper has execute permission (may be stripped by npm pack)
|
|
35
|
+
if (process.platform === 'darwin') {
|
|
36
|
+
const spawnHelper = path.join(PREBUILD_DIR, 'spawn-helper');
|
|
37
|
+
if (fs.existsSync(spawnHelper)) {
|
|
38
|
+
fs.chmodSync(spawnHelper, 0o755);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
34
42
|
process.exit(0);
|