Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
Bump to vercel/pkg-fetch@v3.4.1 (#1616)
Browse files Browse the repository at this point in the history
  • Loading branch information
jesec authored May 14, 2022
1 parent f0c4e8c commit 207b653
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false # prevent test to stop if one fails
matrix:
node-version: [10.x, 12.x, 14.x, 16.x]
node-version: [12.x, 14.x, 16.x, 18.x]
os: [ubuntu-latest, windows-latest] # Skip macos-latest

runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"is-core-module": "2.9.0",
"minimist": "^1.2.6",
"multistream": "^4.1.0",
"pkg-fetch": "3.3.0",
"pkg-fetch": "3.4.1",
"prebuild-install": "6.1.4",
"resolve": "^1.22.0",
"stream-meter": "^1.0.4"
Expand Down
9 changes: 8 additions & 1 deletion test/test-42-fetch-all/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ function nodeRangeToNodeVersion(nodeRange) {
}

for (const platform of knownPlatforms) {
const nodeRanges = ['node8', 'node10', 'node12', 'node14', 'node16'];
const nodeRanges = [
'node8',
'node10',
'node12',
'node14',
'node16',
'node18',
];
for (const nodeRange of nodeRanges) {
const nodeVersion = nodeRangeToNodeVersion(nodeRange);
const archs = ['x64'];
Expand Down
61 changes: 28 additions & 33 deletions test/test-50-fs-runtime-layer-2/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,48 +20,43 @@ const output = './run-time/test-output.exe';

function bitty(version) {
return (
(2 * /^(node|v)?4/.test(version)) |
(2 * /^(node|v)?5/.test(version)) |
(4 * /^(node|v)?6/.test(version)) |
(4 * /^(node|v)?7/.test(version)) |
(4 * /^(node|v)?8/.test(version)) |
(4 * /^(node|v)?9/.test(version)) |
(8 * /^(node|v)?10/.test(version)) |
(8 * /^(node|v)?11/.test(version)) |
(16 * /^(node|v)?12/.test(version)) |
(16 * /^(node|v)?13/.test(version)) |
(32 * /^(node|v)?14/.test(version)) |
(32 * /^(node|v)?16/.test(version))
(64 * /^(node|v)?16/.test(version)) |
(128 * /^(node|v)?18/.test(version))
);
}

const version1 = process.version;
const version2 = target;
if (bitty(version1) !== bitty(version2)) return;

let left, right;
utils.mkdirp.sync(path.dirname(output));

left = utils.spawn.sync('node', [path.basename(input)], {
cwd: path.dirname(input),
});

utils.pkg.sync(['--target', target, '--output', output, input]);

right = utils.spawn.sync('./' + path.basename(output), [], {
cwd: path.dirname(output),
});

left = left.split('\n');
right = right.split('\n');
// right may have less lines, premature exit,
// less trusted, so using left.length here
for (let i = 0; i < left.length; i += 1) {
if (/is out of range/.test(left[i]) && /is out of range/.test(right[i])) {
left[i] = left[i].replace(/ It must be .*\. /, ' ');
right[i] = right[i].replace(/ It must be .*\. /, ' ');
if (bitty(version1) === bitty(version2)) {
let left, right;
utils.mkdirp.sync(path.dirname(output));

left = utils.spawn.sync('node', [path.basename(input)], {
cwd: path.dirname(input),
});

utils.pkg.sync(['--target', target, '--output', output, input]);

right = utils.spawn.sync('./' + path.basename(output), [], {
cwd: path.dirname(output),
});

left = left.split('\n');
right = right.split('\n');
// right may have less lines, premature exit,
// less trusted, so using left.length here
for (let i = 0; i < left.length; i += 1) {
if (/is out of range/.test(left[i]) && /is out of range/.test(right[i])) {
left[i] = left[i].replace(/ It must be .*\. /, ' ');
right[i] = right[i].replace(/ It must be .*\. /, ' ');
}
assert.strictEqual(left[i], right[i]);
}
assert.strictEqual(left[i], right[i]);
}

utils.vacuum.sync(path.dirname(output));
utils.vacuum.sync(path.dirname(output));
}
40 changes: 14 additions & 26 deletions test/test-50-path-as-buffer/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,26 @@ const target = process.argv[2] || host;
const input = './test-x-index.js';
const output = './test-output.exe';

function bitty(version) {
return (
(2 * /^(node|v)?4/.test(version)) |
(2 * /^(node|v)?5/.test(version)) |
(2 * /^(node|v)?6/.test(version)) |
(2 * /^(node|v)?7/.test(version)) |
(2 * /^(node|v)?8/.test(version)) | // 2 = doesn't have URL
(4 * /^(node|v)?9/.test(version)) |
(4 * /^(node|v)?10/.test(version)) |
(4 * /^(node|v)?11/.test(version)) |
(4 * /^(node|v)?12/.test(version)) |
(4 * /^(node|v)?13/.test(version)) |
(4 * /^(node|v)?14/.test(version)) |
(4 * /^(node|v)?16/.test(version))
); // 4 = has URL
function isNode8(version) {
return /^(node|v)?8/.test(version);
}

const version1 = process.version;
const version2 = target;
if (bitty(version1) !== bitty(version2)) return;

let left, right;
if (isNode8(version1) === isNode8(version2)) {
let left, right;

left = utils.spawn.sync('node', [path.basename(input)], {
cwd: path.dirname(input),
});
left = utils.spawn.sync('node', [path.basename(input)], {
cwd: path.dirname(input),
});

utils.pkg.sync(['--target', target, '--output', output, input]);
utils.pkg.sync(['--target', target, '--output', output, input]);

right = utils.spawn.sync('./' + path.basename(output), [], {
cwd: path.dirname(output),
});
right = utils.spawn.sync('./' + path.basename(output), [], {
cwd: path.dirname(output),
});

assert.strictEqual(left, right);
utils.vacuum.sync(output);
assert.strictEqual(left, right);
utils.vacuum.sync(output);
}
12 changes: 9 additions & 3 deletions test/test-79-npm/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ const hostVersion = process.version.match(/^v(\d+)/)[1];
const host = 'node' + hostVersion;
const target = process.argv[2] || host;
const windows = process.platform === 'win32';
const npm = { 0: 2, 4: 2, 6: 3, 7: 4, 8: 5, 9: 5, 10: 5, 12: 6, 14: 6, 16: 7 }[
hostVersion
];
const npm = {
8: 5,
10: 5,
12: 6,
14: 6,
16: 7,
18: 8,
}[hostVersion];

assert(npm !== undefined);

function applyMetaToRight(right, meta) {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2146,10 +2146,10 @@ picomatch@^2.2.3:
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972"
integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==

pkg-fetch@3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/pkg-fetch/-/pkg-fetch-3.3.0.tgz#3afc2fb7a19219839cf75654fa8b54a2630df891"
integrity sha512-xJnIZ1KP+8rNN+VLafwu4tEeV4m8IkFBDdCFqmAJz9K1aiXEtbARmdbEe6HlXWGSVuShSHjFXpfkKRkDBQ5kiA==
pkg-fetch@3.4.1:
version "3.4.1"
resolved "https://registry.yarnpkg.com/pkg-fetch/-/pkg-fetch-3.4.1.tgz#be68bb9f7fdb0f6ed995abc518ab2e35aa64d2fd"
integrity sha512-fS4cdayCa1r4jHkOKGPJKnS9PEs6OWZst+s+m0+CmhmPZObMnxoRnf9T9yUWl+lzM2b5aJF7cnQIySCT7Hq8Dg==
dependencies:
chalk "^4.1.2"
fs-extra "^9.1.0"
Expand Down

0 comments on commit 207b653

Please sign in to comment.