You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ac7d7c5
Browse filesBrowse the repository at this point in the historyBrowse files
Make the resolver runtime-agnostic so it works in browsers, Deno and Bun as well as Node. File contents are decoded without assuming a Node `Buffer`, and browser shims are provided for the `path`, `url` and `graceful-fs` builtins (Node, Deno and Bun keep using the native ones) so the package bundles for the browser — supply your own `fileSystem` there.
MIT License http://www.opensource.org/licenses/mit-license.php
3
+
*/
4
+
5
+
"use strict";
6
+
7
+
// A runtime-agnostic port of Node's `url.fileURLToPath`, built on the global
8
+
// `URL` (available in Node, browsers, Deno and Bun) so the resolver does not
9
+
// depend on the Node `url` builtin. The platform branch can be forced via the
10
+
// `windows` option; otherwise it follows the host platform like Node does.
MIT License http://www.opensource.org/licenses/mit-license.php
3
+
*/
4
+
5
+
"use strict";
6
+
7
+
// Browser stub for the default `graceful-fs` file system. A browser has no
8
+
// ambient file system, so the convenience entry's default resolver has nothing
9
+
// to read — pass your own `fileSystem` to `create()` /
10
+
// `ResolverFactory.createResolver()` instead. Each method throws a clear error
11
+
// if the default is actually used, while keeping the package able to bundle for
12
+
// the browser (no Node `fs` dependency is pulled in).
13
+
14
+
constmessage=
15
+
"enhanced-resolve: no default file system is available in the browser. "+
16
+
"Pass a `fileSystem` to `create()` or `ResolverFactory.createResolver()`.";
17
+
18
+
/**
19
+
* @returns {never} always throws
20
+
*/
21
+
constunavailable=()=>{
22
+
thrownewError(message);
23
+
};
24
+
25
+
// The same set of methods `CachedInputFileSystem` reads from the file system
26
+
// (graceful-fs has no `readJson`/`readJsonSync`, so those stay undefined).
0 commit comments