Skip to content

Commit 1648475

Browse files
committed
refactor: Use path-browserify pkg for path resolution
- Updated the `normalize` and `resolve` function to use equivalent functions from `path-browserify` package
1 parent defdb64 commit 1648475

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

browser.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
// Main entrypoint for ESM web browser environments. Avoids using Node.js
22
// specific libraries, such as "path".
33
//
4-
// TODO: figure out reasonable web equivalents for "resolve", "normalize", etc.
54
import { camelCase, decamelize, looksLikeNumber } from './build/lib/string-utils.js'
65
import { YargsParser } from './build/lib/yargs-parser.js'
6+
// Using `path-browserify` package from local dependency
7+
import path from './vendor/path-browserify/index.js';
8+
79
const parser = new YargsParser({
810
cwd: () => { return '' },
911
format: (str, arg) => { return str.replace('%s', arg) },
10-
normalize: (str) => { return str },
11-
resolve: (str) => { return str },
12+
normalize: path.normalize, // Use `path-browserify`
13+
resolve: path.resolve, // Use `path-browserify`
1214
require: () => {
1315
throw Error('loading config from files not currently supported in browser')
1416
},

0 commit comments

Comments
 (0)