Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump glob to 10.3.12 #16450

Merged
merged 8 commits into from Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/babel-cli/package.json
Expand Up @@ -28,7 +28,7 @@
"commander": "^4.0.1",
"convert-source-map": "^2.0.0",
"fs-readdir-recursive": "^1.1.0",
"glob": "^7.2.0",
"glob": "condition:BABEL_8_BREAKING ? ^10.3.12 : ^7.2.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"glob": "condition:BABEL_8_BREAKING ? ^10.3.12 : ^7.2.0",
"glob": "condition:BABEL_8_BREAKING ? ^10.3.12 : ^7.2.0 (esm:sync)",

this should fix CI

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I just figured out the same change from the conditionParser.ts.

"make-dir": "condition:BABEL_8_BREAKING ? : ^2.1.0",
"slash": "condition:BABEL_8_BREAKING ? ^3.0.0 : ^2.0.0"
},
Expand Down
10 changes: 8 additions & 2 deletions packages/babel-cli/src/babel/options.ts
Expand Up @@ -2,7 +2,7 @@ import fs from "fs";

import commander from "commander";
import { version, DEFAULT_EXTENSIONS } from "@babel/core";
import glob from "glob";
import { sync as globSync } from "glob";

import type { InputOptions } from "@babel/core";

Expand Down Expand Up @@ -213,7 +213,13 @@ export default function parseArgv(args: Array<string>): CmdOptions | null {
const errors: string[] = [];

let filenames = commander.args.reduce(function (globbed: string[], input) {
let files = glob.sync(input);
let files = process.env.BABEL_8_BREAKING
? // glob 9+ no longer sorts the result, here we maintain the glob 7 behaviour
// https://github.com/isaacs/node-glob/blob/c3cd57ae128faa0e9190492acc743bb779ac4054/common.js#L151
globSync(input, { dotRelative: true }).sort(function alphasort(a, b) {
return a.localeCompare(b, "en");
})
: globSync(input);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using the plugin, would this work?

import * as glob from "glob";
Suggested change
let files = process.env.BABEL_8_BREAKING
? // glob 9+ no longer sorts the result, here we maintain the glob 7 behaviour
// https://github.com/isaacs/node-glob/blob/c3cd57ae128faa0e9190492acc743bb779ac4054/common.js#L151
globSync(input, { dotRelative: true }).sort(function alphasort(a, b) {
return a.localeCompare(b, "en");
})
: globSync(input);
let files = process.env.BABEL_8_BREAKING
? // glob 9+ no longer sorts the result, here we maintain the glob 7 behaviour
// https://github.com/isaacs/node-glob/blob/c3cd57ae128faa0e9190492acc743bb779ac4054/common.js#L151
(USE_ESM ? glob.default : glob).sync(input, { dotRelative: true }).sort(function alphasort(a, b) {
return a.localeCompare(b, "en");
})
: glob.sync(input);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The USE_ESM branch should be moved to the Babel 7, otherwise it looks good to me, I will give it a try.

if (!files.length) files = [input];
globbed.push(...files);
return globbed;
Expand Down
83 changes: 54 additions & 29 deletions yarn.lock
Expand Up @@ -233,7 +233,7 @@ __metadata:
commander: "npm:^4.0.1"
convert-source-map: "npm:^2.0.0"
fs-readdir-recursive: "npm:^1.1.0"
glob: "npm:^7.2.0"
glob: "condition:BABEL_8_BREAKING ? ^10.3.12 : ^7.2.0"
make-dir: "condition:BABEL_8_BREAKING ? : ^2.1.0"
semver: "npm:^6.3.1"
slash: "condition:BABEL_8_BREAKING ? ^3.0.0 : ^2.0.0"
Expand Down Expand Up @@ -10325,6 +10325,35 @@ __metadata:
languageName: node
linkType: hard

"glob-BABEL_8_BREAKING-false@npm:glob@^7.2.0, glob@npm:^7.0.0, glob@npm:^7.1.0, glob@npm:^7.1.1, glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.2.0":
version: 7.2.3
resolution: "glob@npm:7.2.3"
dependencies:
fs.realpath: "npm:^1.0.0"
inflight: "npm:^1.0.4"
inherits: "npm:2"
minimatch: "npm:^3.1.1"
once: "npm:^1.3.0"
path-is-absolute: "npm:^1.0.0"
checksum: 10/59452a9202c81d4508a43b8af7082ca5c76452b9fcc4a9ab17655822e6ce9b21d4f8fbadabe4fe3faef448294cec249af305e2cd824b7e9aaf689240e5e96a7b
languageName: node
linkType: hard

"glob-BABEL_8_BREAKING-true@npm:glob@^10.3.12":
version: 10.3.12
resolution: "glob@npm:10.3.12"
dependencies:
foreground-child: "npm:^3.1.0"
jackspeak: "npm:^2.3.6"
minimatch: "npm:^9.0.1"
minipass: "npm:^7.0.4"
path-scurry: "npm:^1.10.2"
bin:
glob: dist/esm/bin.mjs
checksum: 10/9e8186abc22dc824b5dd86cefd8e6b5621a72d1be7f68bacc0fd681e8c162ec5546660a6ec0553d6a74757a585e655956c7f8f1a6d24570e8d865c307323d178
languageName: node
linkType: hard

"glob-parent@npm:^3.1.0":
version: 3.1.0
resolution: "glob-parent@npm:3.1.0"
Expand Down Expand Up @@ -10393,6 +10422,16 @@ __metadata:
languageName: node
linkType: hard

"glob@condition:BABEL_8_BREAKING ? ^10.3.12 : ^7.2.0":
version: 0.0.0-condition-0bad83
resolution: "glob@condition:BABEL_8_BREAKING?^10.3.12:^7.2.0#0bad83"
dependencies:
glob-BABEL_8_BREAKING-false: "npm:glob@^7.2.0"
glob-BABEL_8_BREAKING-true: "npm:glob@^10.3.12"
checksum: 10/2887d633e02b13b92c81b3de2eebbd841f454a90f972f23ca45bafab4408fca132873b5486b24b373d9f0366ff55232b67cbddead5e17fd9b6ba0cfd1bde3232
languageName: node
linkType: hard

"glob@npm:^10.3.10":
version: 10.3.10
resolution: "glob@npm:10.3.10"
Expand All @@ -10408,20 +10447,6 @@ __metadata:
languageName: node
linkType: hard

"glob@npm:^7.0.0, glob@npm:^7.1.0, glob@npm:^7.1.1, glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.2.0":
version: 7.2.3
resolution: "glob@npm:7.2.3"
dependencies:
fs.realpath: "npm:^1.0.0"
inflight: "npm:^1.0.4"
inherits: "npm:2"
minimatch: "npm:^3.1.1"
once: "npm:^1.3.0"
path-is-absolute: "npm:^1.0.0"
checksum: 10/59452a9202c81d4508a43b8af7082ca5c76452b9fcc4a9ab17655822e6ce9b21d4f8fbadabe4fe3faef448294cec249af305e2cd824b7e9aaf689240e5e96a7b
languageName: node
linkType: hard

"glob@npm:^8.0.3":
version: 8.0.3
resolution: "glob@npm:8.0.3"
Expand Down Expand Up @@ -11683,7 +11708,7 @@ __metadata:
languageName: node
linkType: hard

"jackspeak@npm:^2.3.5":
"jackspeak@npm:^2.3.5, jackspeak@npm:^2.3.6":
version: 2.3.6
resolution: "jackspeak@npm:2.3.6"
dependencies:
Expand Down Expand Up @@ -12824,6 +12849,13 @@ __metadata:
languageName: node
linkType: hard

"lru-cache@npm:^10.2.0":
version: 10.2.0
resolution: "lru-cache@npm:10.2.0"
checksum: 10/502ec42c3309c0eae1ce41afca471f831c278566d45a5273a0c51102dee31e0e250a62fa9029c3370988df33a14188a38e682c16143b794de78668de3643e302
languageName: node
linkType: hard

"lru-cache@npm:^4.0.1":
version: 4.1.5
resolution: "lru-cache@npm:4.1.5"
Expand All @@ -12850,13 +12882,6 @@ __metadata:
languageName: node
linkType: hard

"lru-cache@npm:^9.1.1 || ^10.0.0":
version: 10.1.0
resolution: "lru-cache@npm:10.1.0"
checksum: 10/207278d6fa711fb1f94a0835d4d4737441d2475302482a14785b10515e4c906a57ebf9f35bf060740c9560e91c7c1ad5a04fd7ed030972a9ba18bce2a228e95b
languageName: node
linkType: hard

"magic-string@npm:^0.27.0":
version: 0.27.0
resolution: "magic-string@npm:0.27.0"
Expand Down Expand Up @@ -13165,7 +13190,7 @@ __metadata:
languageName: node
linkType: hard

"minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0":
"minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0, minipass@npm:^7.0.4":
version: 7.0.4
resolution: "minipass@npm:7.0.4"
checksum: 10/e864bd02ceb5e0707696d58f7ce3a0b89233f0d686ef0d447a66db705c0846a8dc6f34865cd85256c1472ff623665f616b90b8ff58058b2ad996c5de747d2d18
Expand Down Expand Up @@ -14102,13 +14127,13 @@ __metadata:
languageName: node
linkType: hard

"path-scurry@npm:^1.10.1":
version: 1.10.1
resolution: "path-scurry@npm:1.10.1"
"path-scurry@npm:^1.10.1, path-scurry@npm:^1.10.2":
version: 1.10.2
resolution: "path-scurry@npm:1.10.2"
dependencies:
lru-cache: "npm:^9.1.1 || ^10.0.0"
lru-cache: "npm:^10.2.0"
minipass: "npm:^5.0.0 || ^6.0.2 || ^7.0.0"
checksum: 10/eebfb8304fef1d4f7e1486df987e4fd77413de4fce16508dea69fcf8eb318c09a6b15a7a2f4c22877cec1cb7ecbd3071d18ca9de79eeece0df874a00f1f0bdc8
checksum: 10/a2bbbe8dc284c49dd9be78ca25f3a8b89300e0acc24a77e6c74824d353ef50efbf163e64a69f4330b301afca42d0e2229be0560d6d616ac4e99d48b4062016b1
languageName: node
linkType: hard

Expand Down