yargs 18.0.0-browser.0 → 18.0.0-browser.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/lib/command.js
CHANGED
|
@@ -4,7 +4,6 @@ import { applyMiddleware, commandMiddlewareFactory, } from './middleware.js';
|
|
|
4
4
|
import { parseCommand } from './parse-command.js';
|
|
5
5
|
import { isYargsInstance, } from './yargs-factory.js';
|
|
6
6
|
import { maybeAsyncResult } from './utils/maybe-async-result.js';
|
|
7
|
-
import { join, dirname } from 'node:path';
|
|
8
7
|
const DEFAULT_MARKER = /(^\*)|(^\$0)/;
|
|
9
8
|
export class CommandInstance {
|
|
10
9
|
constructor(usage, validation, globalMiddleware, shim) {
|
|
@@ -20,7 +19,7 @@ export class CommandInstance {
|
|
|
20
19
|
addDirectory(dir, req, callerFile, opts) {
|
|
21
20
|
opts = opts || {};
|
|
22
21
|
this.requireCache.add(callerFile);
|
|
23
|
-
const fullDirPath = join(dirname(callerFile), dir);
|
|
22
|
+
const fullDirPath = this.shim.path.join(this.shim.path.dirname(callerFile), dir);
|
|
24
23
|
const files = this.shim.readdirSync(fullDirPath, {
|
|
25
24
|
recursive: opts.recurse ? true : false,
|
|
26
25
|
});
|
|
@@ -57,7 +56,7 @@ export class CommandInstance {
|
|
|
57
56
|
supportedExtension = true;
|
|
58
57
|
}
|
|
59
58
|
if (supportedExtension) {
|
|
60
|
-
const joined = join(fullDirPath, file);
|
|
59
|
+
const joined = this.shim.path.join(fullDirPath, file);
|
|
61
60
|
const module = req(joined);
|
|
62
61
|
const visited = visit(module, joined, file);
|
|
63
62
|
if (visited) {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { YError } from '../yerror.js';
|
|
2
|
-
import { createRequire } from 'node:module';
|
|
3
|
-
const require = createRequire(import.meta.url);
|
|
4
2
|
let previouslyVisitedConfigs = [];
|
|
5
3
|
let shim;
|
|
6
4
|
export function applyExtends(config, cwd, mergeExtends, _shim) {
|
|
@@ -26,7 +24,7 @@ export function applyExtends(config, cwd, mergeExtends, _shim) {
|
|
|
26
24
|
previouslyVisitedConfigs.push(pathToDefault);
|
|
27
25
|
defaultConfig = isPath
|
|
28
26
|
? JSON.parse(shim.readFileSync(pathToDefault, 'utf8'))
|
|
29
|
-
: require(config.extends);
|
|
27
|
+
: _shim.require(config.extends);
|
|
30
28
|
delete config.extends;
|
|
31
29
|
defaultConfig = applyExtends(defaultConfig, shim.path.dirname(pathToDefault), mergeExtends, shim);
|
|
32
30
|
}
|
|
@@ -6,7 +6,7 @@ import escalade from 'escalade/sync'
|
|
|
6
6
|
import { inspect } from 'util'
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
8
|
import Parser from 'yargs-parser'
|
|
9
|
-
import { basename, dirname, extname, relative, resolve } from 'path'
|
|
9
|
+
import { basename, dirname, extname, relative, resolve, join } from 'path'
|
|
10
10
|
import { getProcessArgvBin } from '../../build/lib/utils/process-argv.js'
|
|
11
11
|
import stringWidth from 'string-width';
|
|
12
12
|
import y18n from 'y18n'
|
|
@@ -37,7 +37,8 @@ export default {
|
|
|
37
37
|
dirname,
|
|
38
38
|
extname,
|
|
39
39
|
relative,
|
|
40
|
-
resolve
|
|
40
|
+
resolve,
|
|
41
|
+
join
|
|
41
42
|
},
|
|
42
43
|
process: {
|
|
43
44
|
argv: () => process.argv,
|