aboutsummaryrefslogtreecommitdiff
path: root/node_modules/yargs/lib/platform-shims/esm.mjs
diff options
context:
space:
mode:
authorJoel Kronqvist <work.joelkronqvist@pm.me>2022-03-11 20:46:06 +0200
committerJoel Kronqvist <work.joelkronqvist@pm.me>2022-03-11 20:46:06 +0200
commit080c5819d87b933816d724a83f3bf4f1686770a7 (patch)
tree4a2ccc68b27edf7d4cbc586c932cc7542b655e19 /node_modules/yargs/lib/platform-shims/esm.mjs
parent5ac7049a9d30733165cc212dee308163c2a14644 (diff)
parentd003b82235a9329f912522a2f70aa950dfce4998 (diff)
downloadLYLLRuoka-080c5819d87b933816d724a83f3bf4f1686770a7.tar.gz
LYLLRuoka-080c5819d87b933816d724a83f3bf4f1686770a7.zip
Merge branch 'master' of https://github.com/JoelHMikael/FoodJS
Updating remote changes
Diffstat (limited to 'node_modules/yargs/lib/platform-shims/esm.mjs')
-rw-r--r--node_modules/yargs/lib/platform-shims/esm.mjs67
1 files changed, 67 insertions, 0 deletions
diff --git a/node_modules/yargs/lib/platform-shims/esm.mjs b/node_modules/yargs/lib/platform-shims/esm.mjs
new file mode 100644
index 0000000..bc04791
--- /dev/null
+++ b/node_modules/yargs/lib/platform-shims/esm.mjs
@@ -0,0 +1,67 @@
+'use strict'
+
+import { notStrictEqual, strictEqual } from 'assert'
+import cliui from 'cliui'
+import escalade from 'escalade/sync'
+import { format, inspect } from 'util'
+import { readFileSync } from 'fs'
+import { fileURLToPath } from 'url';
+import Parser from 'yargs-parser'
+import { basename, dirname, extname, relative, resolve } from 'path'
+import { getProcessArgvBin } from '../../build/lib/utils/process-argv.js'
+import { YError } from '../../build/lib/yerror.js'
+import y18n from 'y18n'
+
+const REQUIRE_ERROR = 'require is not supported by ESM'
+const REQUIRE_DIRECTORY_ERROR = 'loading a directory of commands is not supported yet for ESM'
+
+const mainFilename = fileURLToPath(import.meta.url).split('node_modules')[0]
+const __dirname = fileURLToPath(import.meta.url)
+
+export default {
+ assert: {
+ notStrictEqual,
+ strictEqual
+ },
+ cliui,
+ findUp: escalade,
+ getEnv: (key) => {
+ return process.env[key]
+ },
+ inspect,
+ getCallerFile: () => {
+ throw new YError(REQUIRE_DIRECTORY_ERROR)
+ },
+ getProcessArgvBin,
+ mainFilename: mainFilename || process.cwd(),
+ Parser,
+ path: {
+ basename,
+ dirname,
+ extname,
+ relative,
+ resolve
+ },
+ process: {
+ argv: () => process.argv,
+ cwd: process.cwd,
+ execPath: () => process.execPath,
+ exit: process.exit,
+ nextTick: process.nextTick,
+ stdColumns: typeof process.stdout.columns !== 'undefined' ? process.stdout.columns : null
+ },
+ readFileSync,
+ require: () => {
+ throw new YError(REQUIRE_ERROR)
+ },
+ requireDirectory: () => {
+ throw new YError(REQUIRE_DIRECTORY_ERROR)
+ },
+ stringWidth: (str) => {
+ return [...str].length
+ },
+ y18n: y18n({
+ directory: resolve(__dirname, '../../../locales'),
+ updateFiles: false
+ })
+}