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

Neutral JavaScript runtime support (Deno, Bun, etc) #16

Closed
sgammon opened this issue Mar 31, 2024 · 0 comments
Closed

Neutral JavaScript runtime support (Deno, Bun, etc) #16

sgammon opened this issue Mar 31, 2024 · 0 comments

Comments

@sgammon
Copy link
Contributor

sgammon commented Mar 31, 2024

Hey there @isaacs,

For context, I am using glob upstream, but I want to use it with Deno, and I can't because these imports need to be prefixed. PR is incoming shortly.

Related issues:

Distribution diff:

diff --git a/node_modules/path-scurry/dist/commonjs/index.js b/node_modules/path-scurry/dist/commonjs/index.js
index 6e330d4..623a29e 100644
--- a/node_modules/path-scurry/dist/commonjs/index.js
+++ b/node_modules/path-scurry/dist/commonjs/index.js
@@ -25,14 +25,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
 Object.defineProperty(exports, "__esModule", { value: true });
 exports.PathScurry = exports.Path = exports.PathScurryDarwin = exports.PathScurryPosix = exports.PathScurryWin32 = exports.PathScurryBase = exports.PathPosix = exports.PathWin32 = exports.PathBase = exports.ChildrenCache = exports.ResolveCache = void 0;
 const lru_cache_1 = require("lru-cache");
-const path_1 = require("path");
-const url_1 = require("url");
-const actualFS = __importStar(require("fs"));
-const fs_1 = require("fs");
+const path_1 = require("node:path");
+const url_1 = require("node:url");
+const process = require("node:process");
+const actualFS = __importStar(require("node:fs"));
+const fs_1 = require("node:fs");
 const realpathSync = fs_1.realpathSync.native;
 // TODO: test perf of fs/promises realpath vs realpathCB,
 // since the promises one uses realpath.native
-const promises_1 = require("fs/promises");
+const promises_1 = require("node:fs/promises");
 const minipass_1 = require("minipass");
 const defaultFS = {
     lstatSync: fs_1.lstatSync,
diff --git a/node_modules/path-scurry/dist/esm/index.js b/node_modules/path-scurry/dist/esm/index.js
index 2ce978e..3550240 100644
--- a/node_modules/path-scurry/dist/esm/index.js
+++ b/node_modules/path-scurry/dist/esm/index.js
@@ -1,12 +1,13 @@
 import { LRUCache } from 'lru-cache';
-import { posix, win32 } from 'path';
-import { fileURLToPath } from 'url';
-import * as actualFS from 'fs';
-import { lstatSync, readdir as readdirCB, readdirSync, readlinkSync, realpathSync as rps, } from 'fs';
+import { posix, win32 } from 'node:path';
+import { fileURLToPath } from 'node:url';
+import * as actualFS from 'node:fs';
+import { lstatSync, readdir as readdirCB, readdirSync, readlinkSync, realpathSync as rps, } from 'node:fs';
 const realpathSync = rps.native;
 // TODO: test perf of fs/promises realpath vs realpathCB,
 // since the promises one uses realpath.native
-import { lstat, readdir, readlink, realpath } from 'fs/promises';
+import { lstat, readdir, readlink, realpath } from 'node:fs/promises';
+import process from 'node:process';
 import { Minipass } from 'minipass';
 const defaultFS = {
     lstatSync,

This issue body was partially generated by patch-package.

sgammon added a commit to sgammon/minipass that referenced this issue Mar 31, 2024
This adjusts Node built-in imports to use the `node:` prefix, so
that such imports work on all runtimes.

Fixes and closes isaacs#54
Relates to isaacs/node-glob#580 and isaacs/path-scurry#16

Signed-off-by: Sam Gammon <sam@elide.dev>
sgammon added a commit to sgammon/path-scurry that referenced this issue Mar 31, 2024
This changeset fixes and closes isaacs#16 so that this
package can be used on all JS runtimes.

Signed-off-by: Sam Gammon <sam@elide.ventures>
sgammon added a commit to sgammon/path-scurry that referenced this issue Mar 31, 2024
This changeset fixes and closes isaacs#16 so that this
package can be used on all JS runtimes.

Relates to isaacs/node-glob#580

Signed-off-by: Sam Gammon <sam@elide.ventures>
sgammon added a commit to sgammon/hashlock that referenced this issue Mar 31, 2024
- feat: support all popular js runtimes
  - patches for `glob`, `minipass`, and `path-scurry`
  - upstream prs (listed below)
  - test entrypoint commands
- test: add test entrypoints for each major runtime
- test: add scripts to test entrypoint with each major runtime
- chore: sync lockfiles

Related Issues
- isaacs/node-glob#580
- isaacs/path-scurry#16
- isaacs/minipass#54
- tj/commander.js#2169

Upstream PRs
- isaacs/node-glob#581
- isaacs/minipass#55
- isaacs/path-scurry#17
- tj/commander.js#2170

Signed-off-by: Sam Gammon <sam@elide.dev>
sgammon added a commit to sgammon/hashlock that referenced this issue Mar 31, 2024
- feat: support all popular js runtimes
  - patches for `glob`, `minipass`, and `path-scurry`
  - upstream prs (listed below)
  - test entrypoint commands
- test: add test entrypoints for each major runtime
- test: add scripts to test entrypoint with each major runtime
- chore: sync lockfiles

Related Issues
- isaacs/node-glob#580
- isaacs/path-scurry#16
- isaacs/minipass#54
- tj/commander.js#2169

Upstream PRs
- isaacs/node-glob#581
- isaacs/minipass#55
- isaacs/path-scurry#17
- tj/commander.js#2170

Signed-off-by: Sam Gammon <sam@elide.dev>
sgammon added a commit to sgammon/hashlock that referenced this issue Mar 31, 2024
- feat: support all popular js runtimes
  - patches for `glob`, `minipass`, and `path-scurry`
  - upstream prs (listed below)
  - test entrypoint commands
- test: add test entrypoints for each major runtime
- test: add scripts to test entrypoint with each major runtime
- chore: sync lockfiles

Related Issues
- isaacs/node-glob#580
- isaacs/path-scurry#16
- isaacs/minipass#54
- tj/commander.js#2169

Upstream PRs
- isaacs/node-glob#581
- isaacs/minipass#55
- isaacs/path-scurry#17
- tj/commander.js#2170

Signed-off-by: Sam Gammon <sam@elide.dev>
sgammon added a commit to sgammon/hashlock that referenced this issue Mar 31, 2024
* feat: support all runtimes

- feat: support all popular js runtimes
  - patches for `glob`, `minipass`, and `path-scurry`
  - upstream prs (listed below)
  - test entrypoint commands
- test: add test entrypoints for each major runtime
- test: add scripts to test entrypoint with each major runtime
- chore: sync lockfiles

Related Issues
- isaacs/node-glob#580
- isaacs/path-scurry#16
- isaacs/minipass#54
- tj/commander.js#2169

Upstream PRs
- isaacs/node-glob#581
- isaacs/minipass#55
- isaacs/path-scurry#17
- tj/commander.js#2170

Signed-off-by: Sam Gammon <sam@elide.dev>

* chore: version bump → `1.0.3`

Signed-off-by: Sam Gammon <sam@elide.ventures>

---------

Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.ventures>
@isaacs isaacs closed this as completed in 38c51b2 May 9, 2024
isaacs pushed a commit to isaacs/minipass that referenced this issue May 9, 2024
This adjusts Node built-in imports to use the `node:` prefix, so
that such imports work on all runtimes.

Fixes and closes #54
Relates to isaacs/node-glob#580 and isaacs/path-scurry#16

Signed-off-by: Sam Gammon <sam@elide.dev>

PR-URL: #55
Credit: @sgammon
Close: #55
Reviewed-by: @isaacs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant