-
-
Notifications
You must be signed in to change notification settings - Fork 498
Description
Hello there, @isaacs!
I'm a big fan of node-glob
, having used it in several projects now. It is super fast and generally just works great 😄 however, in a tool downstream, hashlock
, I am trying to make it runtime-neutral, so that consuming users can use it on whatever runtime they want (Deno, Bun, Node, are my targets).
glob
already works fantastically well on Node and Bun, but Deno seems to hiccup, because it wants node:
-prefixed imports for builtins. Not shipping with these was quite sensible. Now that Node 16 is EOL, though, there really should be very few Node instances out in the wild that are running pre-16 versions, so node:
-prefixed imports can be relied upon.
Using these imports works universally across Node, Bun, and Deno, and so for a very small change glob
can be used anywhere. See below for the diff that I generated with patch-package
, and a PR is incoming shortly.
Note
For glob
to be fully compatible with Deno, changes are needed path-scurry
and minipass
as well. Those PRs and issues will tag this one for easy reference.
Related issues:
- Neutral JavaScript runtime support (Deno, Bun, etc) path-scurry#16
- Neutral JavaScript runtime support (Deno, Bun, etc) minipass#54
diff --git a/node_modules/glob/dist/commonjs/glob.js b/node_modules/glob/dist/commonjs/glob.js
index 5e37335..f961ccc 100644
--- a/node_modules/glob/dist/commonjs/glob.js
+++ b/node_modules/glob/dist/commonjs/glob.js
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.Glob = void 0;
const minimatch_1 = require("minimatch");
const path_scurry_1 = require("path-scurry");
-const url_1 = require("url");
+const url_1 = require("node:url");
const pattern_js_1 = require("./pattern.js");
const walker_js_1 = require("./walker.js");
// if no process global, just call it linux.
diff --git a/node_modules/glob/dist/esm/glob.js b/node_modules/glob/dist/esm/glob.js
index 2a2b15d..da56f87 100644
--- a/node_modules/glob/dist/esm/glob.js
+++ b/node_modules/glob/dist/esm/glob.js
@@ -1,6 +1,6 @@
import { Minimatch } from 'minimatch';
import { PathScurry, PathScurryDarwin, PathScurryPosix, PathScurryWin32, } from 'path-scurry';
-import { fileURLToPath } from 'url';
+import { fileURLToPath } from 'node:url';
import { Pattern } from './pattern.js';
import { GlobStream, GlobWalker } from './walker.js';
// if no process global, just call it linux.
This issue body was partially generated by patch-package.