Skip to content

Commit d4c704c

Browse files
committed
fix: revert of "refactor: replace globby with tinyglobby (#103)"
This reverts commit 99a2632.
1 parent 8913dff commit d4c704c

File tree

7 files changed

+46
-56
lines changed

7 files changed

+46
-56
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,15 @@ use of `package.json` configuration.
160160

161161
### Scripts
162162

163-
`scripts` is a [glob](https://github.com/SuperchupuDev/tinyglobby)
163+
`scripts` is a [glob](https://github.com/sindresorhus/globby)
164164
or list of globs. Files specified as `scripts` will be compiled
165165
using `v8::ScriptCompiler` and placed into executable without
166166
sources. They must conform to the JS standards of those Node.js versions
167167
you target (see [Targets](#targets)), i.e. be already transpiled.
168168

169169
### Assets
170170

171-
`assets` is a [glob](https://github.com/SuperchupuDev/tinyglobby)
171+
`assets` is a [glob](https://github.com/sindresorhus/globby)
172172
or list of globs. Files specified as `assets` will be packaged
173173
into executable as raw content without modifications. Javascript
174174
files may also be specified as `assets`. Their sources will

lib/walker.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
import assert from 'assert';
44
import fs from 'fs/promises';
5+
import globby from 'globby';
56
import path from 'path';
67
import { builtinModules } from 'module';
78
import picomatch from 'picomatch';
8-
import { globSync } from 'tinyglobby';
99

1010
import {
1111
ALIAS_AS_RELATIVE,
@@ -194,7 +194,7 @@ function upon(p: string, base: string) {
194194
}
195195

196196
function collect(ps: string[]) {
197-
return globSync(ps, { absolute: true, dot: true });
197+
return globby.sync(ps, { dot: true });
198198
}
199199

200200
function expandFiles(efs: string | string[], base: string) {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@babel/parser": "^7.23.0",
2727
"@babel/types": "^7.23.0",
2828
"@yao-pkg/pkg-fetch": "3.5.17",
29+
"globby": "11.1.0",
2930
"into-stream": "^6.0.0",
3031
"minimist": "^1.2.6",
3132
"multistream": "^4.1.0",
@@ -35,7 +36,6 @@
3536
"resolve": "^1.22.0",
3637
"stream-meter": "^1.0.4",
3738
"tar": "^7.4.3",
38-
"tinyglobby": "^0.2.9",
3939
"unzipper": "^0.12.3"
4040
},
4141
"devDependencies": {

test/test-79-npm/main.js

+22-15
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const UPM = process.env.USE_PREINSTALLED_MODULES || false; // USE_PREINSTALLED_M
1111
const fs = require('fs');
1212
const path = require('path');
1313
const assert = require('assert');
14-
const { globSync } = require('tinyglobby');
14+
const globby = require('globby');
1515
const utils = require('../utils.js');
1616

1717
assert(!module.parent);
@@ -127,12 +127,19 @@ if (!UPM) {
127127
})();
128128

129129
// note to developpers:
130-
// you can set the env variable FILTER to something like "better-sqlite3/*.js"
130+
// you can set the env variable FILTER to something like "better-sqlite3/*.js"
131131
// to restrict this test to this single test case
132-
const inputs = globSync([process.env.FILTER || '*/*.js'], {
133-
absolute: true,
134-
ignore: ['*/*.config.js', '*/*.meta.js', '*/gulpfile.js', '*/*fixture*'],
135-
}).map((p) => path.normalize(p));
132+
const inputs = globby
133+
.sync([
134+
process.env.FILTER || './*/*.js',
135+
'!./*/*.config.js',
136+
'!./*/*.meta.js',
137+
'!./*/gulpfile.js',
138+
'!./*/*fixture*',
139+
])
140+
.map(function (result) {
141+
return path.resolve(result);
142+
});
136143

137144
let times = {};
138145
const ci = process.env.CI;
@@ -302,14 +309,14 @@ inputs.some(function (input) {
302309
const deployFiles = [];
303310

304311
if (!meta.deployFiles && !meta.deployFilesFrom) {
305-
globSync(path.join(foldy, 'node_modules', '**', '*.node')).some(
306-
function (deployFrom) {
312+
globby
313+
.sync(path.join(foldy, 'node_modules', '**', '*.node'))
314+
.some(function (deployFrom) {
307315
deployFiles.push([
308316
deployFrom,
309317
path.join(path.dirname(output), path.basename(deployFrom)),
310318
]);
311-
},
312-
);
319+
});
313320
}
314321

315322
const deployFilesRelative = [];
@@ -355,8 +362,9 @@ inputs.some(function (input) {
355362
if (statFrom.isFile()) {
356363
deployFiles.push([deployFrom, deployTo]);
357364
} else {
358-
globSync(path.join(deployFrom, '**', '*')).some(
359-
function (deployFrom2) {
365+
globby
366+
.sync(path.join(deployFrom, '**', '*'))
367+
.some(function (deployFrom2) {
360368
const r = path.relative(deployFrom, deployFrom2);
361369
const deployTo2 = path.join(deployTo, r);
362370
if (fs.existsSync(deployFrom2)) {
@@ -365,8 +373,7 @@ inputs.some(function (input) {
365373
deployFiles.push([deployFrom2, deployTo2]);
366374
}
367375
}
368-
},
369-
);
376+
});
370377
}
371378
}
372379
});
@@ -404,7 +411,7 @@ inputs.some(function (input) {
404411
}
405412
}
406413

407-
const rubbishes = globSync(path.join(path.dirname(output), '**', '*'));
414+
const rubbishes = globby.sync(path.join(path.dirname(output), '**', '*'));
408415

409416
rubbishes.some(function (rubbish) {
410417
utils.vacuum.sync(rubbish);

test/test.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
'use strict';
44

5+
const globby = require('globby');
56
const path = require('path');
67
const pc = require('picocolors');
7-
const { globSync } = require('tinyglobby');
88
const utils = require('./utils.js');
99
const { spawn } = require('child_process');
1010
const host = 'node' + utils.getNodeMajorVersion();
@@ -53,7 +53,6 @@ function joinAndForward(d) {
5353
}
5454

5555
const list = [];
56-
const ignore = [];
5756

5857
// test that should be run on `host` target only
5958
const npmTests = [
@@ -80,14 +79,14 @@ if (flavor.match(/^test/)) {
8079
list.push(joinAndForward('**/main.js'));
8180
if (flavor === 'no-npm') {
8281
// TODO: fix this test
83-
ignore.push(joinAndForward('test-79-npm'));
82+
list.push('!' + joinAndForward('test-79-npm'));
8483
npmTests.forEach((t) => {
85-
ignore.push(joinAndForward(t));
84+
list.push('!' + joinAndForward(t));
8685
});
8786
}
8887
}
8988

90-
const files = globSync(list, { ignore });
89+
const files = globby.sync(list);
9190

9291
function msToHumanDuration(ms) {
9392
if (ms < 1000) return `${ms}ms`;

test/utils.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const assert = require('assert');
44
const path = require('path');
55
const rimraf = require('rimraf');
6-
const { globSync } = require('tinyglobby');
6+
const globby = require('globby');
77
const { execSync, spawnSync } = require('child_process');
88
const {
99
existsSync,
@@ -194,7 +194,7 @@ module.exports.filesBefore = function (n) {
194194
for (const ni of n) {
195195
module.exports.vacuum.sync(ni);
196196
}
197-
return globSync('**/*').sort();
197+
return globby.sync('**/*', { nodir: true }).sort();
198198
};
199199

200200
/**
@@ -204,10 +204,7 @@ module.exports.filesBefore = function (n) {
204204
* @param {string[]} newComers New files produced by test that should be removed
205205
*/
206206
module.exports.filesAfter = function (before, newComers) {
207-
// actual files in the directory
208-
const a = globSync('**/*').sort();
209-
210-
// check that all files in `b` exist, otherwise fail
207+
const a = globby.sync('**/*', { nodir: true }).sort();
211208
for (const bi of before) {
212209
if (a.indexOf(bi) < 0) {
213210
assert(false, `${bi} disappeared!?`);

yarn.lock

+12-25
Original file line numberDiff line numberDiff line change
@@ -2137,11 +2137,6 @@ fastq@^1.6.0:
21372137
dependencies:
21382138
reusify "^1.0.4"
21392139

2140-
fdir@^6.4.2:
2141-
version "6.4.2"
2142-
resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.4.2.tgz#ddaa7ce1831b161bc3657bb99cb36e1622702689"
2143-
integrity sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==
2144-
21452140
fetch-blob@^3.1.2, fetch-blob@^3.1.4:
21462141
version "3.2.0"
21472142
resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9"
@@ -2441,18 +2436,7 @@ globalthis@^1.0.3:
24412436
define-properties "^1.2.1"
24422437
gopd "^1.0.1"
24432438

2444-
2445-
version "13.2.2"
2446-
resolved "https://registry.yarnpkg.com/globby/-/globby-13.2.2.tgz#63b90b1bf68619c2135475cbd4e71e66aa090592"
2447-
integrity sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==
2448-
dependencies:
2449-
dir-glob "^3.0.1"
2450-
fast-glob "^3.3.0"
2451-
ignore "^5.2.4"
2452-
merge2 "^1.4.1"
2453-
slash "^4.0.0"
2454-
2455-
globby@^11.1.0:
2439+
[email protected], globby@^11.1.0:
24562440
version "11.1.0"
24572441
resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b"
24582442
integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==
@@ -2464,6 +2448,17 @@ globby@^11.1.0:
24642448
merge2 "^1.4.1"
24652449
slash "^3.0.0"
24662450

2451+
2452+
version "13.2.2"
2453+
resolved "https://registry.yarnpkg.com/globby/-/globby-13.2.2.tgz#63b90b1bf68619c2135475cbd4e71e66aa090592"
2454+
integrity sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==
2455+
dependencies:
2456+
dir-glob "^3.0.1"
2457+
fast-glob "^3.3.0"
2458+
ignore "^5.2.4"
2459+
merge2 "^1.4.1"
2460+
slash "^4.0.0"
2461+
24672462
gopd@^1.0.1:
24682463
version "1.0.1"
24692464
resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c"
@@ -4662,14 +4657,6 @@ text-table@^0.2.0:
46624657
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
46634658
integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==
46644659

4665-
tinyglobby@^0.2.9:
4666-
version "0.2.10"
4667-
resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.10.tgz#e712cf2dc9b95a1f5c5bbd159720e15833977a0f"
4668-
integrity sha512-Zc+8eJlFMvgatPZTl6A9L/yht8QqdmUNtURHaKZLmKBE12hNPSrqNkUp2cs3M/UKmNVVAMFQYSjYIVHDjW5zew==
4669-
dependencies:
4670-
fdir "^6.4.2"
4671-
picomatch "^4.0.2"
4672-
46734660
titleize@^3.0.0:
46744661
version "3.0.0"
46754662
resolved "https://registry.yarnpkg.com/titleize/-/titleize-3.0.0.tgz#71c12eb7fdd2558aa8a44b0be83b8a76694acd53"

0 commit comments

Comments
 (0)