@vltpkg/cli-sdk 1.0.0-rc.12 ā 1.0.0-rc.14
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/dist/commands/publish.js
CHANGED
|
@@ -124,7 +124,7 @@ const commandSingle = async (location, conf) => {
|
|
|
124
124
|
const manifestDir = dirname(manifestPath);
|
|
125
125
|
const manifest = conf.options.packageJson.read(manifestDir);
|
|
126
126
|
assert(!manifest.private, error('Package has been marked as private'));
|
|
127
|
-
const { tag
|
|
127
|
+
const { tag, access, registry, 'dry-run': dry = false, otp, } = conf.options;
|
|
128
128
|
const registryUrl = new URL(registry);
|
|
129
129
|
const runOptions = {
|
|
130
130
|
cwd: manifestDir,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,WAAW,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAErC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAEjE,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC;IACX,OAAO,EAAE,SAAS;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,GAAG,UAAU;QACb,IAAI,EAAE,aAAa;KACpB,CAAC,CAAA;IAEF,OAAO;QACL,EAAE,EAAE,GAAG,IAAI,IAAI,OAAO,EAAE;QACxB,IAAI;QACJ,OAAO;QACP,GAAG;QACH,MAAM;QACN,QAAQ,EAAE,WAAW,CAAC,MAAM;QAC5B,SAAS;QACT,MAAM;QACN,IAAI,EAAE,WAAW,CAAC,MAAM;QACxB,YAAY;QACZ,KAAK;KACN,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport { RegistryClient } from '@vltpkg/registry-client'\nimport type { CacheEntry } from '@vltpkg/registry-client'\nimport { run } from '@vltpkg/run'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport { packTarball } from '../pack-tarball.ts'\nimport type { Views } from '../view.ts'\nimport assert from 'node:assert'\nimport { asError } from '@vltpkg/types'\nimport { dirname, resolve } from 'node:path'\nimport prettyBytes from 'pretty-bytes'\nimport { actual } from '@vltpkg/graph'\nimport { Query } from '@vltpkg/query'\nimport type { LoadedConfig } from '../config/index.ts'\nimport { createHostContextsMap } from '../query-host-contexts.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'publish',\n usage: '',\n description: `Create a tarball from a package and publish it to the configured registry.\n \n This command will pack the package in the current directory or specified folder,\n and then upload it to the configured registry.`,\n options: {\n tag: {\n description: 'Publish the package with the given tag',\n value: '<tag>',\n },\n access: {\n description: 'Set access level (public or restricted)',\n value: '<level>',\n },\n otp: {\n description: `Provide an OTP to use when publishing a package.`,\n value: '<otp>',\n },\n 'publish-directory': {\n description: `Directory to use for pack and publish operations instead of the current directory.\n The directory must exist and nothing will be copied to it.`,\n value: '<path>',\n },\n },\n })\n\nexport type CommandResultSingle = {\n id: string\n name: string\n version: string\n tag: string\n registry: string\n shasum?: string\n integrity?: string\n size: number\n access: string\n unpackedSize: number\n files: string[]\n}\n\nexport type CommandResult =\n | CommandResultSingle\n | CommandResultSingle[]\n\nexport const views = {\n human: results => {\n const item = (r: CommandResultSingle) => {\n const lines = [\n `š¦ Package: ${r.id}`,\n `š·ļø Tag: ${r.tag}`,\n `š” Registry: ${r.registry}`,\n `š ${r.files.length} Files`,\n ...r.files.map(f => ` - ${f}`),\n `š Package Size: ${prettyBytes(r.size)}`,\n `š Unpacked Size: ${prettyBytes(r.unpackedSize)}`,\n ]\n if (r.shasum) lines.push(`š Shasum: ${r.shasum}`)\n if (r.integrity) lines.push(`š Integrity: ${r.integrity}`)\n return lines.join('\\n')\n }\n return Array.isArray(results) ?\n results.map(item).join('\\n\\n')\n : item(results)\n },\n json: r => r,\n} as const satisfies Views<CommandResult>\n\nexport const command: CommandFn<CommandResult> = async conf => {\n const { options, projectRoot } = conf\n const queryString = conf.get('scope')\n const paths = conf.get('workspace')\n const groups = conf.get('workspace-group')\n const recursive = conf.get('recursive')\n\n const locations: string[] = []\n let single: string | null = null\n\n if (queryString) {\n const mainManifest = options.packageJson.maybeRead(projectRoot)\n let graph\n if (mainManifest) {\n graph = actual.load({\n ...options,\n mainManifest,\n monorepo: options.monorepo,\n loadManifests: false,\n })\n }\n const hostContexts = await createHostContextsMap(conf)\n const query = new Query({\n /* c8 ignore next */\n nodes: graph ? new Set(graph.nodes.values()) : new Set(),\n edges: graph?.edges ?? new Set(),\n importers: graph?.importers ?? new Set(),\n securityArchive: undefined,\n hostContexts,\n })\n const { nodes } = await query.search(queryString, {\n signal: new AbortController().signal,\n })\n for (const node of nodes) {\n const { location } = node.toJSON()\n assert(\n location,\n error(`node ${node.id} has no location`, {\n found: node,\n }),\n )\n locations.push(resolve(projectRoot, location))\n }\n } else if (paths?.length || groups?.length || recursive) {\n for (const workspace of options.monorepo ?? []) {\n locations.push(workspace.fullpath)\n }\n } else {\n single = options.packageJson.find(process.cwd()) ?? projectRoot\n }\n\n if (single) {\n return commandSingle(single, conf)\n }\n\n assert(\n locations.length > 0,\n error('No workspaces or query results found'),\n )\n\n const results: CommandResultSingle[] = []\n for (const location of locations) {\n results.push(await commandSingle(location, conf))\n }\n return results\n}\n\nconst commandSingle = async (\n location: string,\n conf: LoadedConfig,\n) => {\n const manifestPath = conf.options.packageJson.find(location)\n assert(manifestPath, 'No package.json found')\n const manifestDir = dirname(manifestPath)\n const manifest = conf.options.packageJson.read(manifestDir)\n\n assert(\n !manifest.private,\n error('Package has been marked as private'),\n )\n\n const {\n tag = 'latest',\n access,\n registry,\n 'dry-run': dry = false,\n otp,\n } = conf.options\n const registryUrl = new URL(registry)\n\n const runOptions = {\n cwd: manifestDir,\n projectRoot: conf.projectRoot,\n packageJson: conf.options.packageJson,\n manifest,\n ignoreMissing: true,\n ignorePrePost: true,\n }\n\n await run({\n ...runOptions,\n arg0: 'prepublishOnly',\n })\n\n await run({\n ...runOptions,\n arg0: 'prepublish',\n })\n\n await run({\n ...runOptions,\n arg0: 'prepack',\n })\n\n await run({\n ...runOptions,\n arg0: 'prepare',\n })\n\n const {\n name,\n version,\n tarballName,\n tarballData,\n unpackedSize,\n files,\n integrity,\n shasum,\n } = await packTarball(manifest, manifestDir, conf)\n\n await run({\n ...runOptions,\n arg0: 'postpack',\n })\n\n await run({\n ...runOptions,\n arg0: 'publish',\n })\n\n const publishMetadata = {\n _id: name,\n name,\n description: manifest.description || '',\n 'dist-tags': {\n [tag]: version,\n },\n versions: {\n [version]: {\n ...manifest,\n _id: `${name}@${version}`,\n _nodeVersion: process.versions.node,\n dist: {\n ...manifest.dist,\n integrity,\n shasum,\n tarball: new URL(`${name}/-/${tarballName}`, registryUrl)\n .href,\n },\n },\n },\n access,\n _attachments: {\n [tarballName]: {\n content_type: 'application/octet-stream',\n data: tarballData.toString('base64'),\n length: tarballData.length,\n },\n },\n }\n\n const rc = new RegistryClient(conf.options)\n const publishUrl = new URL(\n name.startsWith('@') ? name.replace('/', '%2F') : name,\n registryUrl,\n )\n\n if (!dry) {\n let response: CacheEntry\n try {\n response = await rc.request(publishUrl, {\n method: 'PUT',\n headers: {\n 'content-type': 'application/json',\n // These control what type of OTP auth flow is used\n 'npm-auth-type': 'web',\n 'npm-command': 'publish',\n },\n body: JSON.stringify(publishMetadata),\n otp,\n })\n } catch (err) {\n throw error('Failed to publish package', {\n cause: asError(err),\n })\n }\n\n if (response.statusCode !== 200 && response.statusCode !== 201) {\n let extraMsg = ''\n // special case 404 errors to provide a better hint to the user\n if (response.statusCode === 404) {\n extraMsg =\n \".\\nā ļø Make sure you're logged in and have access to publish the package.\"\n }\n throw error(`Failed to publish package${extraMsg}`, {\n url: publishUrl,\n response,\n })\n }\n }\n\n await run({\n ...runOptions,\n arg0: 'postpublish',\n })\n\n return {\n id: `${name}@${version}`,\n name,\n version,\n tag,\n access,\n registry: registryUrl.origin,\n integrity,\n shasum,\n size: tarballData.length,\n unpackedSize,\n files,\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,WAAW,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAErC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAEjE,MAAM,CAAC,MAAM,KAAK,GAAiB,GAAG,EAAE,CACtC,YAAY,CAAC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,CAAC;QACR,GAAG,UAAU;QACb,IAAI,EAAE,aAAa;KACpB,CAAC,CAAA;IAEF,OAAO;QACL,EAAE,EAAE,GAAG,IAAI,IAAI,OAAO,EAAE;QACxB,IAAI;QACJ,OAAO;QACP,GAAG;QACH,MAAM;QACN,QAAQ,EAAE,WAAW,CAAC,MAAM;QAC5B,SAAS;QACT,MAAM;QACN,IAAI,EAAE,WAAW,CAAC,MAAM;QACxB,YAAY;QACZ,KAAK;KACN,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport { RegistryClient } from '@vltpkg/registry-client'\nimport type { CacheEntry } from '@vltpkg/registry-client'\nimport { run } from '@vltpkg/run'\nimport { commandUsage } from '../config/usage.ts'\nimport type { CommandFn, CommandUsage } from '../index.ts'\nimport { packTarball } from '../pack-tarball.ts'\nimport type { Views } from '../view.ts'\nimport assert from 'node:assert'\nimport { asError } from '@vltpkg/types'\nimport { dirname, resolve } from 'node:path'\nimport prettyBytes from 'pretty-bytes'\nimport { actual } from '@vltpkg/graph'\nimport { Query } from '@vltpkg/query'\nimport type { LoadedConfig } from '../config/index.ts'\nimport { createHostContextsMap } from '../query-host-contexts.ts'\n\nexport const usage: CommandUsage = () =>\n commandUsage({\n command: 'publish',\n usage: '',\n description: `Create a tarball from a package and publish it to the configured registry.\n \n This command will pack the package in the current directory or specified folder,\n and then upload it to the configured registry.`,\n options: {\n tag: {\n description: 'Publish the package with the given tag',\n value: '<tag>',\n },\n access: {\n description: 'Set access level (public or restricted)',\n value: '<level>',\n },\n otp: {\n description: `Provide an OTP to use when publishing a package.`,\n value: '<otp>',\n },\n 'publish-directory': {\n description: `Directory to use for pack and publish operations instead of the current directory.\n The directory must exist and nothing will be copied to it.`,\n value: '<path>',\n },\n },\n })\n\nexport type CommandResultSingle = {\n id: string\n name: string\n version: string\n tag: string\n registry: string\n shasum?: string\n integrity?: string\n size: number\n access: string\n unpackedSize: number\n files: string[]\n}\n\nexport type CommandResult =\n | CommandResultSingle\n | CommandResultSingle[]\n\nexport const views = {\n human: results => {\n const item = (r: CommandResultSingle) => {\n const lines = [\n `š¦ Package: ${r.id}`,\n `š·ļø Tag: ${r.tag}`,\n `š” Registry: ${r.registry}`,\n `š ${r.files.length} Files`,\n ...r.files.map(f => ` - ${f}`),\n `š Package Size: ${prettyBytes(r.size)}`,\n `š Unpacked Size: ${prettyBytes(r.unpackedSize)}`,\n ]\n if (r.shasum) lines.push(`š Shasum: ${r.shasum}`)\n if (r.integrity) lines.push(`š Integrity: ${r.integrity}`)\n return lines.join('\\n')\n }\n return Array.isArray(results) ?\n results.map(item).join('\\n\\n')\n : item(results)\n },\n json: r => r,\n} as const satisfies Views<CommandResult>\n\nexport const command: CommandFn<CommandResult> = async conf => {\n const { options, projectRoot } = conf\n const queryString = conf.get('scope')\n const paths = conf.get('workspace')\n const groups = conf.get('workspace-group')\n const recursive = conf.get('recursive')\n\n const locations: string[] = []\n let single: string | null = null\n\n if (queryString) {\n const mainManifest = options.packageJson.maybeRead(projectRoot)\n let graph\n if (mainManifest) {\n graph = actual.load({\n ...options,\n mainManifest,\n monorepo: options.monorepo,\n loadManifests: false,\n })\n }\n const hostContexts = await createHostContextsMap(conf)\n const query = new Query({\n /* c8 ignore next */\n nodes: graph ? new Set(graph.nodes.values()) : new Set(),\n edges: graph?.edges ?? new Set(),\n importers: graph?.importers ?? new Set(),\n securityArchive: undefined,\n hostContexts,\n })\n const { nodes } = await query.search(queryString, {\n signal: new AbortController().signal,\n })\n for (const node of nodes) {\n const { location } = node.toJSON()\n assert(\n location,\n error(`node ${node.id} has no location`, {\n found: node,\n }),\n )\n locations.push(resolve(projectRoot, location))\n }\n } else if (paths?.length || groups?.length || recursive) {\n for (const workspace of options.monorepo ?? []) {\n locations.push(workspace.fullpath)\n }\n } else {\n single = options.packageJson.find(process.cwd()) ?? projectRoot\n }\n\n if (single) {\n return commandSingle(single, conf)\n }\n\n assert(\n locations.length > 0,\n error('No workspaces or query results found'),\n )\n\n const results: CommandResultSingle[] = []\n for (const location of locations) {\n results.push(await commandSingle(location, conf))\n }\n return results\n}\n\nconst commandSingle = async (\n location: string,\n conf: LoadedConfig,\n) => {\n const manifestPath = conf.options.packageJson.find(location)\n assert(manifestPath, 'No package.json found')\n const manifestDir = dirname(manifestPath)\n const manifest = conf.options.packageJson.read(manifestDir)\n\n assert(\n !manifest.private,\n error('Package has been marked as private'),\n )\n\n const {\n tag,\n access,\n registry,\n 'dry-run': dry = false,\n otp,\n } = conf.options\n const registryUrl = new URL(registry)\n\n const runOptions = {\n cwd: manifestDir,\n projectRoot: conf.projectRoot,\n packageJson: conf.options.packageJson,\n manifest,\n ignoreMissing: true,\n ignorePrePost: true,\n }\n\n await run({\n ...runOptions,\n arg0: 'prepublishOnly',\n })\n\n await run({\n ...runOptions,\n arg0: 'prepublish',\n })\n\n await run({\n ...runOptions,\n arg0: 'prepack',\n })\n\n await run({\n ...runOptions,\n arg0: 'prepare',\n })\n\n const {\n name,\n version,\n tarballName,\n tarballData,\n unpackedSize,\n files,\n integrity,\n shasum,\n } = await packTarball(manifest, manifestDir, conf)\n\n await run({\n ...runOptions,\n arg0: 'postpack',\n })\n\n await run({\n ...runOptions,\n arg0: 'publish',\n })\n\n const publishMetadata = {\n _id: name,\n name,\n description: manifest.description || '',\n 'dist-tags': {\n [tag]: version,\n },\n versions: {\n [version]: {\n ...manifest,\n _id: `${name}@${version}`,\n _nodeVersion: process.versions.node,\n dist: {\n ...manifest.dist,\n integrity,\n shasum,\n tarball: new URL(`${name}/-/${tarballName}`, registryUrl)\n .href,\n },\n },\n },\n access,\n _attachments: {\n [tarballName]: {\n content_type: 'application/octet-stream',\n data: tarballData.toString('base64'),\n length: tarballData.length,\n },\n },\n }\n\n const rc = new RegistryClient(conf.options)\n const publishUrl = new URL(\n name.startsWith('@') ? name.replace('/', '%2F') : name,\n registryUrl,\n )\n\n if (!dry) {\n let response: CacheEntry\n try {\n response = await rc.request(publishUrl, {\n method: 'PUT',\n headers: {\n 'content-type': 'application/json',\n // These control what type of OTP auth flow is used\n 'npm-auth-type': 'web',\n 'npm-command': 'publish',\n },\n body: JSON.stringify(publishMetadata),\n otp,\n })\n } catch (err) {\n throw error('Failed to publish package', {\n cause: asError(err),\n })\n }\n\n if (response.statusCode !== 200 && response.statusCode !== 201) {\n let extraMsg = ''\n // special case 404 errors to provide a better hint to the user\n if (response.statusCode === 404) {\n extraMsg =\n \".\\nā ļø Make sure you're logged in and have access to publish the package.\"\n }\n throw error(`Failed to publish package${extraMsg}`, {\n url: publishUrl,\n response,\n })\n }\n }\n\n await run({\n ...runOptions,\n arg0: 'postpublish',\n })\n\n return {\n id: `${name}@${version}`,\n name,\n version,\n tag,\n access,\n registry: registryUrl.origin,\n integrity,\n shasum,\n size: tarballData.length,\n unpackedSize,\n files,\n }\n}\n"]}
|
|
@@ -133,6 +133,9 @@ export declare const definition: import("jackspeak").Jack<{
|
|
|
133
133
|
description: string;
|
|
134
134
|
default: NodeJS.Architecture;
|
|
135
135
|
};
|
|
136
|
+
libc: {
|
|
137
|
+
description: string;
|
|
138
|
+
};
|
|
136
139
|
'node-version': {
|
|
137
140
|
hint: string;
|
|
138
141
|
description: string;
|
|
@@ -144,6 +147,7 @@ export declare const definition: import("jackspeak").Jack<{
|
|
|
144
147
|
before: import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
|
|
145
148
|
os: import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
|
|
146
149
|
arch: import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
|
|
150
|
+
libc: import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
|
|
147
151
|
'node-version': import("jackspeak").ConfigOption<"string", false, readonly string[] | undefined>;
|
|
148
152
|
} & {
|
|
149
153
|
'git-shallow': {
|
|
@@ -200,7 +204,6 @@ export declare const definition: import("jackspeak").Jack<{
|
|
|
200
204
|
description: string;
|
|
201
205
|
};
|
|
202
206
|
'workspace-group': {
|
|
203
|
-
short: string;
|
|
204
207
|
description: string;
|
|
205
208
|
};
|
|
206
209
|
} & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/config/definition.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,QAOd,CAAA;AAEV,eAAO,MAAM,aAAa,cAKjB,CAAA;AAsDT;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGX,CAAA;AAEV;;GAEG;AACH,eAAO,MAAM,cAAc,uBAW1B,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAA;AAEtC,eAAO,MAAM,UAAU,OACjB,MAAM,KACT,QAAQ,CAAC,MAAM,QAAQ,CAAC,GAAG,SACkC,CAAA;AAKhE;;GAEG;AACH,eAAO,MAAM,YAAY,iGAMf,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvD,eAAO,MAAM,aAAa,MAAO,MAAM,KAAG,CAAC,IAAI,WACN,CAAA;AAwCzC,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/config/definition.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,QAOd,CAAA;AAEV,eAAO,MAAM,aAAa,cAKjB,CAAA;AAsDT;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGX,CAAA;AAEV;;GAEG;AACH,eAAO,MAAM,cAAc,uBAW1B,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAA;AAEtC,eAAO,MAAM,UAAU,OACjB,MAAM,KACT,QAAQ,CAAC,MAAM,QAAQ,CAAC,GAAG,SACkC,CAAA;AAKhE;;GAEG;AACH,eAAO,MAAM,YAAY,iGAMf,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvD,eAAO,MAAM,aAAa,MAAO,MAAM,KAAG,CAAC,IAAI,WACN,CAAA;AAwCzC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAgPH,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAkOP,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsFvB,CAAA;AAEJ,eAAO,MAAM,mBAAmB,gBAS/B,CAAA;AAED,eAAO,MAAM,aAAa,gBAC2C,CAAA"}
|
|
@@ -289,6 +289,11 @@ export const definition = j
|
|
|
289
289
|
packages based on their \`cpu\` value.`,
|
|
290
290
|
default: process.arch,
|
|
291
291
|
},
|
|
292
|
+
libc: {
|
|
293
|
+
description: `Override the libc family to use as the selector when choosing
|
|
294
|
+
packages based on their \`libc\` value (e.g. glibc, musl).
|
|
295
|
+
By default, this is auto-detected on Linux systems.`,
|
|
296
|
+
},
|
|
292
297
|
'node-version': {
|
|
293
298
|
hint: 'version',
|
|
294
299
|
description: `Node version to use when choosing packages based on
|
|
@@ -381,7 +386,6 @@ export const definition = j
|
|
|
381
386
|
supported.`,
|
|
382
387
|
},
|
|
383
388
|
'workspace-group': {
|
|
384
|
-
short: 'g',
|
|
385
389
|
description: `Specify named workspace group names to load and operate on
|
|
386
390
|
when doing recursive operations on workspaces.`,
|
|
387
391
|
},
|
|
@@ -1 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,CAAC,CAAA;QACnB,oBAAoB;QACpB,IAAI,CAAC,GAAG;YAAE,MAAM,KAAK,CAAC,mBAAmB,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAA;QACxD,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC,EAAE,CAAA;QAC3C,OAAO,KAAK,CAAC,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAA;IACpC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE,CAChC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport { XDG } from '@vltpkg/xdg'\nimport { jack } from 'jackspeak'\n\nexport const defaultView =\n // If stdout is a TTY, use human output\n process.stdout.isTTY ? 'human'\n // If its not a TTY but is a CI environment, use human output\n // TODO: make a better view option for CI environments\n : process.env.CI ? 'human'\n // Otherwise, use json output\n : 'json'\n\nexport const defaultEditor = () =>\n process.env.EDITOR ||\n process.env.VISUAL ||\n (process.platform === 'win32' ?\n `${process.env.SYSTEMROOT}\\\\notepad.exe`\n : 'vi')\n\nconst canonicalCommands = {\n bugs: 'bugs',\n build: 'build',\n cache: 'cache',\n ci: 'ci',\n config: 'config',\n docs: 'docs',\n exec: 'exec',\n 'exec-local': 'exec-local',\n help: 'help',\n init: 'init',\n install: 'install',\n login: 'login',\n logout: 'logout',\n list: 'list',\n ls: 'ls',\n pack: 'pack',\n pkg: 'pkg',\n publish: 'publish',\n query: 'query',\n 'run-exec': 'run-exec',\n run: 'run',\n serve: 'serve',\n token: 'token',\n uninstall: 'uninstall',\n update: 'update',\n 'exec-cache': 'exec-cache',\n version: 'version',\n whoami: 'whoami',\n} as const\n\nconst aliases = {\n i: 'install',\n add: 'install',\n rm: 'uninstall',\n u: 'update',\n p: 'pkg',\n pub: 'publish',\n q: 'query',\n b: 'build',\n r: 'run',\n 'run-script': 'run',\n rx: 'run-exec',\n s: 'serve',\n x: 'exec',\n xl: 'exec-local',\n h: 'help',\n '?': 'help',\n ls: 'list',\n xc: 'exec-cache',\n} as const\n\n/**\n * Command aliases mapped to their canonical names\n */\nexport const commands = {\n ...canonicalCommands,\n ...aliases,\n} as const\n\n/**\n * Canonical command names mapped to an array of its aliases\n */\nexport const commandAliases = Object.entries(aliases).reduce(\n (acc, [alias, canonical]) => {\n const commandAliases = acc.get(canonical)\n if (commandAliases) {\n commandAliases.push(alias)\n } else {\n acc.set(canonical, [alias])\n }\n return acc\n },\n new Map<string, string[]>(),\n)\n\nexport type Commands = typeof commands\n\nexport const getCommand = (\n s?: string,\n): Commands[keyof Commands] | undefined =>\n s && s in commands ? commands[s as keyof Commands] : undefined\n\nconst xdg = new XDG('vlt')\nconst cacheDir = xdg.cache()\n\n/**\n * Fields that are parsed as a set of key=value pairs\n */\nexport const recordFields = [\n 'git-hosts',\n 'registries',\n 'git-host-archives',\n 'scope-registries',\n 'jsr-registries',\n] as const\n\nexport type RecordField = (typeof recordFields)[number]\n\nexport const isRecordField = (s: string): s is RecordField =>\n recordFields.includes(s as RecordField)\n\nconst stopParsingCommands: Commands[keyof Commands][] = [\n 'run',\n 'run-exec',\n 'exec-local',\n 'exec',\n]\n\nlet stopParsing: boolean | undefined = undefined\n\nconst j = jack({\n envPrefix: 'VLT',\n allowPositionals: true,\n usage: `vlt [<options>] [<cmd> [<args> ...]]`,\n stopAtPositionalTest: arg => {\n if (stopParsing) return true\n const a = arg as keyof Commands\n // we stop parsing AFTER the thing, so you can do\n // vlt run --vlt --configs scriptName --args --for --script\n // or\n // vlt exec --vlt --configs command --args --for --command\n if (stopParsingCommands.includes(commands[a])) {\n stopParsing = true\n }\n return false\n },\n})\n .heading('vlt')\n .description(\n `More documentation available at <https://docs.vlt.sh>`,\n )\n .heading('Subcommands')\n\nj.description(Object.keys(canonicalCommands).join(', '), {\n pre: true,\n}).description(\n 'Run `vlt <cmd> --help` for more information about a specific command',\n)\n\nexport const definition = j\n /**\n * Definition of all configuration values used by vlt.\n */\n .heading('Configuration')\n .description(\n `If a \\`vlt.json\\` file is present in the root of the current project,\n then that will be used as a source of configuration information.\n\n Next, the \\`vlt.json\\` file in the XDG specified config directory\n will be checked, and loaded for any fields not set in the local project.\n\n Object type values will be merged together. Set a field to \\`null\\` in\n the JSON configuration to explicitly remove it.\n\n Command-specific fields may be set in a nested \\`command\\` object that\n overrides any options defined at the top level.\n `,\n )\n\n .flag({\n color: {\n short: 'c',\n description: 'Use colors (Default for TTY)',\n },\n 'no-color': {\n short: 'C',\n description: 'Do not use colors (Default for non-TTY)',\n },\n })\n\n .opt({\n registry: {\n hint: 'url',\n default: 'https://registry.npmjs.org/',\n description: `Sets the registry for fetching packages, when no registry\n is explicitly set on a specifier.\n\n For example, \\`express@latest\\` will be resolved by looking\n up the metadata from this registry.\n\n Note that alias specifiers starting with \\`npm:\\` will\n still map to \\`https://registry.npmjs.org/\\` if this is\n changed, unless the a new mapping is created via the\n \\`--registries\\` option.\n `,\n },\n })\n\n .optList({\n registries: {\n hint: 'name=url',\n description: `Specify named registry hosts by their prefix. To set the\n default registry used for non-namespaced specifiers,\n use the \\`--registry\\` option.\n\n Prefixes can be used as a package alias. For example:\n\n \\`\\`\\`\n vlt --registries loc=http://reg.local install foo@loc:foo@1.x\n \\`\\`\\`\n\n By default, the public npm registry is registered to the\n \\`npm:\\` prefix. It is not recommended to change this\n mapping in most cases.\n `,\n },\n\n 'scope-registries': {\n hint: '@scope=url',\n description: `Map package name scopes to registry URLs.\n\n For example,\n \\`--scope-registries @acme=https://registry.acme/\\`\n would tell vlt to fetch any packages named\n \\`@acme/...\\` from the \\`https://registry.acme/\\`\n registry.\n\n Note: this way of specifying registries is more ambiguous,\n compared with using the \\`--registries\\` field and explicit\n prefixes, because instead of failing when the configuration\n is absent, it will instead attempt to fetch from the\n default registry.\n\n By comparison, using\n \\`--registries acme=https://registry.acme/\\` and then\n specifying dependencies such as \\`\"foo\": \"acme:foo@1.x\"\\`\n means that regardless of the name, the package will be\n fetched from the explicitly named registry, or fail if\n no registry is defined with that name.\n\n However, custom registry aliases are not supported by other\n package managers.`,\n },\n\n 'jsr-registries': {\n hint: 'name=url',\n description: `Map alias names to JSR.io registry urls.\n\n For example,\n \\`--jsr-registries acme=https://jsr.acme.io/\\` would\n tell vlt to fetch any packages with the \\`acme:\\` registry\n prefix from the \\`https://jsr.acme.io/\\` registry, using\n the \"npm Compatibility\" translation. So for example,\n the package \\`acme:@foo/bar\\` would fetch the\n \\`@jsr/foo__bar\\` package from the \\`jsr.acme.io\\`\n registry.\n\n By default the \\`jsr\\` alias is always mapped to\n \\`https://npm.jsr.io/\\`, so existing \\`jsr:\\` packages will\n be fetched from the public \\`jsr\\` registry appropriately.\n `,\n },\n\n 'git-hosts': {\n hint: `name=template`,\n short: 'G',\n description: `Map a shorthand name to a git remote URL template.\n\n The \\`template\\` may contain placeholders, which will be\n swapped with the relevant values.\n\n \\`$1\\`, \\`$2\\`, etc. are replaced with the appropriate\n n-th path portion. For example, \\`github:user/project\\`\n would replace the \\`$1\\` in the template with \\`user\\`,\n and \\`$2\\` with \\`project\\`.`,\n },\n\n 'git-host-archives': {\n hint: `name=template`,\n short: 'A',\n description: `Similar to the \\`--git-host <name>=<template>\\` option,\n this option can define a template string that will be\n expanded to provide the URL to download a pre-built\n tarball of the git repository.\n\n In addition to the n-th path portion expansions performed\n by \\`--git-host\\`, this field will also expand the\n string \\`$committish\\` in the template, replacing it with\n the resolved git committish value to be fetched.`,\n },\n })\n\n .opt({\n cache: {\n hint: 'path',\n description: `\n Location of the vlt on-disk cache. Defaults to the platform-specific\n directory recommended by the XDG specification.\n `,\n default: cacheDir,\n },\n tag: {\n description: `Default \\`dist-tag\\` to install or publish`,\n default: 'latest',\n },\n before: {\n hint: 'date',\n description: `Do not install any packages published after this date`,\n },\n os: {\n description: `The operating system to use as the selector when choosing\n packages based on their \\`os\\` value.`,\n default: process.platform,\n },\n arch: {\n description: `CPU architecture to use as the selector when choosing\n packages based on their \\`cpu\\` value.`,\n default: process.arch,\n },\n 'node-version': {\n hint: 'version',\n description: `Node version to use when choosing packages based on\n their \\`engines.node\\` value.`,\n default: process.version,\n },\n })\n\n .flag({\n 'git-shallow': {\n description: `Set to force \\`--depth=1\\` on all git clone actions.\n When set explicitly to false with --no-git-shallow,\n then \\`--depth=1\\` will not be used.\n\n When not set explicitly, \\`--depth=1\\` will be used for\n git hosts known to support this behavior.`,\n },\n })\n .num({\n 'fetch-retries': {\n hint: 'n',\n description: `Number of retries to perform when encountering network\n errors or likely-transient errors from git hosts.`,\n default: 3,\n },\n 'fetch-retry-factor': {\n hint: 'n',\n description: `The exponential backoff factor to use when retrying\n requests due to network issues.`,\n default: 2,\n },\n 'fetch-retry-mintimeout': {\n hint: 'n',\n description: `Number of milliseconds before starting first retry`,\n default: 0,\n },\n 'fetch-retry-maxtimeout': {\n hint: 'n',\n description: `Maximum number of milliseconds between two retries`,\n default: 30_000,\n },\n 'stale-while-revalidate-factor': {\n hint: 'n',\n default: 60,\n description: `If the server does not serve a \\`stale-while-revalidate\\`\n value in the \\`cache-control\\` header, then this multiplier\n is applied to the \\`max-age\\` or \\`s-maxage\\` values.\n\n By default, this is \\`60\\`, so for example a response that\n is cacheable for 5 minutes will allow a stale response\n while revalidating for up to 5 hours.\n\n If the server *does* provide a \\`stale-while-revalidate\\`\n value, then that is always used.\n\n Set to 0 to prevent any \\`stale-while-revalidate\\` behavior\n unless explicitly allowed by the server's \\`cache-control\\`\n header.\n `,\n },\n })\n\n .opt({\n identity: {\n short: 'i',\n validate: (v: unknown) =>\n typeof v === 'string' && /^[a-z0-9]*$/.test(v),\n hint: 'name',\n default: '',\n description: `Provide a string to define an identity for storing auth\n information when logging into registries.\n\n Authentication tokens will be stored in the XDG data\n directory, in \\`vlt/auth/$\\{identity}/keychain.json\\`.\n\n If no identity is provided, then the default \\`''\\` will\n be used, storing the file at \\`vlt/auth/keychain.json\\`.\n\n May only contain lowercase alphanumeric characters.\n `,\n },\n })\n\n .optList({\n workspace: {\n hint: 'ws',\n short: 'w',\n description: `Set to limit the spaces being worked on when working on\n workspaces.\n\n Can be paths or glob patterns matching paths.\n\n Specifying workspaces by package.json name is not\n supported.`,\n },\n 'workspace-group': {\n short: 'g',\n description: `Specify named workspace group names to load and operate on\n when doing recursive operations on workspaces.`,\n },\n })\n\n .opt({\n scope: {\n short: 's',\n hint: 'query',\n description:\n 'Set to filter the scope of an operation using a DSS Query.',\n },\n target: {\n short: 't',\n hint: 'query',\n description:\n 'Set to select packages using a DSS Query selector.',\n },\n })\n\n .flag({\n 'if-present': {\n description: `When running scripts across multiple packages,\n only include packages that have the script.\n\n If this is not set, then the run will fail if any\n packages do not have the script.\n\n This will default to true if --scope, --workspace,\n --workspace-group, or --recursive is set. Otherwise,\n it will default to false.`,\n },\n })\n\n .flag({\n recursive: {\n short: 'r',\n description: `Run an operation across multiple workspaces.\n\n No effect when used in non-monorepo projects.\n\n Implied by setting --workspace or --workspace-group. If\n not set, then the action is run on the project root.`,\n },\n\n bail: {\n short: 'b',\n description: `When running scripts across multiple workspaces, stop\n on the first failure.`,\n default: true,\n },\n\n 'no-bail': {\n short: 'B',\n description: `When running scripts across multiple workspaces, continue\n on failure, running the script for all workspaces.`,\n },\n })\n\n .opt({\n config: {\n hint: 'all | user | project',\n description: `Specify which configuration to show or operate on when running\n \\`vlt config\\` commands. For read operations (get, pick, list):\n \\`all\\` shows merged configuration from both user and project\n files (default). For write operations (set, delete, edit):\n defaults to \\`project\\`. \\`user\\` shows/modifies only user-level\n configuration, \\`project\\` shows/modifies only project-level\n configuration.`,\n validOptions: ['all', 'user', 'project'] as const,\n default: 'all',\n },\n\n editor: {\n hint: 'program',\n description: `The blocking editor to use for \\`vlt config edit\\` and\n any other cases where a file should be opened for\n editing.\n\n Defaults to the \\`EDITOR\\` or \\`VISUAL\\` env if set, or\n \\`notepad.exe\\` on Windows, or \\`vi\\` elsewhere.`,\n default: defaultEditor(),\n },\n\n 'script-shell': {\n hint: 'program',\n description: `The shell to use when executing \\`package.json#scripts\\`.\n\n For \\`vlt exec\\` and \\`vlt exec-local\\`, this is never set,\n meaning that command arguments are run exactly as provided.\n\n For \\`vlt run\\` (and other things that run lifecycle\n scripts in \\`package.json#scripts\\`), the entire command\n with all arguments is provided as a single string, meaning\n that some value must be provided for shell interpretation,\n and so for these contexts, the \\`script-shell\\` value will\n default to \\`/bin/sh\\` on POSIX systems or \\`cmd.exe\\` on\n Windows.\n `,\n },\n\n 'fallback-command': {\n hint: 'command',\n description: `The command to run when the first argument doesn't\n match any known commands.\n\n For pnpm-style behavior, set this to 'run-exec'. e.g:\n \\`\\`\\`\n vlt config set fallback-command=run-exec\n \\`\\`\\``,\n default: 'help',\n validOptions: Object.keys(canonicalCommands),\n },\n })\n\n .opt({\n package: {\n hint: 'p',\n description: `When running \\`vlt exec\\`, this allows you to explicitly\n set the package to search for bins. If not provided, then\n vlt will interpret the first argument as the package, and\n attempt to run the default executable.`,\n },\n })\n\n .opt({\n view: {\n hint: 'output',\n default: defaultView,\n description: `Configures the output format for commands.\n\n Defaults to \\`human\\` if stdout is a TTY, or \\`json\\`\n if it is not.\n\n - human: Maximally ergonomic output reporting for human\n consumption.\n - json: Parseable JSON output for machines.\n - inspect: Output results with \\`util.inspect\\`.\n - gui: Start a local web server and opens a browser to\n explore the results. (Only relevant for certain\n commands.)\n - mermaid: Output mermaid diagramming syntax. (Only\n relevant for certain commands.)\n - silent: Suppress all output to stdout.\n\n If the requested view format is not supported for the\n current command, or if no option is provided, then it\n will fall back to the default.\n `,\n validOptions: [\n 'human',\n 'json',\n 'mermaid',\n 'gui',\n 'inspect',\n 'silent',\n ] as const,\n },\n })\n\n .optList({\n 'dashboard-root': {\n hint: 'path',\n description: `The root directory to use for the dashboard browser-based UI.\n If not set, the user home directory is used.`,\n },\n })\n\n .flag({\n 'save-dev': {\n short: 'D',\n description: `Save installed packages to a package.json file as\n devDependencies`,\n },\n 'save-optional': {\n short: 'O',\n description: `Save installed packages to a package.json file as\n optionalDependencies`,\n },\n 'save-peer': {\n description: `Save installed packages to a package.json file as\n peerDependencies`,\n },\n 'save-prod': {\n short: 'P',\n description: `Save installed packages into dependencies specifically.\n This is useful if a package already exists in\n devDependencies or optionalDependencies, but you want to\n move it to be a non-optional production dependency.`,\n },\n })\n\n .opt({\n 'expect-results': {\n hint: 'value',\n validate: (v: unknown) =>\n typeof v === 'string' && /^([<>]=?)?[0-9]+$/.test(v),\n description: `When running \\`vlt query\\`, this option allows you to\n set a expected number of resulting items.\n\n Accepted values are numbers and strings.\n\n Strings starting with \\`>\\`, \\`<\\`, \\`>=\\` or \\`<=\\`\n followed by a number can be used to check if the result\n is greater than or less than a specific number.`,\n },\n })\n\n .flag({\n 'dry-run': {\n description: 'Run command without making any changes',\n },\n 'expect-lockfile': {\n description:\n 'Fail if lockfile is missing or out of date. Used by ci command to enforce lockfile integrity.',\n },\n 'frozen-lockfile': {\n description:\n 'Fail if lockfile is missing or out of sync with package.json. Prevents any lockfile modifications.',\n },\n 'lockfile-only': {\n description:\n 'Only update the lockfile (vlt-lock.json) and package.json files, skip all node_modules operations including package extraction and filesystem changes.',\n },\n })\n .opt({\n 'allow-scripts': {\n hint: 'query',\n description: `Filter which packages are allowed to run lifecycle scripts using DSS query syntax.\n When provided, only packages matching the query will execute their\n install, preinstall, postinstall, prepare, preprepare, and postprepare scripts.\n Defaults to ':not(*)' which means no scripts will be run.\n \n Example: --allow-scripts=\":root > *, #my-package\"\n Runs scripts only for direct dependencies of the current project and any occurrences\n of a specific dependency with the name \"my-package\" anywhere in the dependency graph.`,\n },\n })\n .opt({\n access: {\n description: 'Set the access level of the package',\n validOptions: ['public', 'restricted'] as const,\n default: 'public',\n },\n })\n .opt({\n otp: {\n description: `Provide an OTP to use when publishing a package.`,\n },\n 'publish-directory': {\n hint: 'path',\n description: `Directory to use for pack and publish operations instead of the current directory.\n The directory must exist and nothing will be copied to it.`,\n },\n port: {\n hint: 'number',\n description: `Port for the browser-based UI server when using vlt serve command (default: 8000).`,\n },\n 'registry-port': {\n hint: 'number',\n description: `Port for the VSR registry when using vlt serve command (default: 1337).`,\n },\n })\n\n .flag({\n yes: {\n short: 'y',\n description: `Automatically accept any confirmation prompts`,\n },\n version: {\n short: 'v',\n description: 'Print the version',\n },\n help: {\n short: 'h',\n description: 'Print helpful information',\n },\n all: {\n short: 'a',\n description: 'Show all commands, bins, and flags',\n },\n })\n\nexport const getSortedCliOptions = () => {\n const defs = definition.toJSON()\n return getSortedKeys().map((k: keyof typeof defs) => {\n const def = defs[k]\n /* c8 ignore next */\n if (!def) throw error('invalid key found', { found: k })\n if (def.type === 'boolean') return `--${k}`\n return `--${k}=<${def.hint ?? k}>`\n })\n}\n\nexport const getSortedKeys = () =>\n Object.keys(definition.toJSON()).sort((a, b) => a.localeCompare(b))\n"]}
|
|
1
|
+
{"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/config/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,MAAM,CAAC,MAAM,WAAW;AACtB,uCAAuC;AACvC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO;IAC5B,6DAA6D;IAC7D,sDAAsD;IACxD,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO;QACxB,6BAA6B;QAC/B,CAAC,CAAC,MAAM,CAAA;AAEV,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE,CAChC,OAAO,CAAC,GAAG,CAAC,MAAM;IAClB,OAAO,CAA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vltpkg/error-cause'\nimport { XDG } from '@vltpkg/xdg'\nimport { jack } from 'jackspeak'\n\nexport const defaultView =\n // If stdout is a TTY, use human output\n process.stdout.isTTY ? 'human'\n // If its not a TTY but is a CI environment, use human output\n // TODO: make a better view option for CI environments\n : process.env.CI ? 'human'\n // Otherwise, use json output\n : 'json'\n\nexport const defaultEditor = () =>\n process.env.EDITOR ||\n process.env.VISUAL ||\n (process.platform === 'win32' ?\n `${process.env.SYSTEMROOT}\\\\notepad.exe`\n : 'vi')\n\nconst canonicalCommands = {\n bugs: 'bugs',\n build: 'build',\n cache: 'cache',\n ci: 'ci',\n config: 'config',\n docs: 'docs',\n exec: 'exec',\n 'exec-local': 'exec-local',\n help: 'help',\n init: 'init',\n install: 'install',\n login: 'login',\n logout: 'logout',\n list: 'list',\n ls: 'ls',\n pack: 'pack',\n pkg: 'pkg',\n publish: 'publish',\n query: 'query',\n 'run-exec': 'run-exec',\n run: 'run',\n serve: 'serve',\n token: 'token',\n uninstall: 'uninstall',\n update: 'update',\n 'exec-cache': 'exec-cache',\n version: 'version',\n whoami: 'whoami',\n} as const\n\nconst aliases = {\n i: 'install',\n add: 'install',\n rm: 'uninstall',\n u: 'update',\n p: 'pkg',\n pub: 'publish',\n q: 'query',\n b: 'build',\n r: 'run',\n 'run-script': 'run',\n rx: 'run-exec',\n s: 'serve',\n x: 'exec',\n xl: 'exec-local',\n h: 'help',\n '?': 'help',\n ls: 'list',\n xc: 'exec-cache',\n} as const\n\n/**\n * Command aliases mapped to their canonical names\n */\nexport const commands = {\n ...canonicalCommands,\n ...aliases,\n} as const\n\n/**\n * Canonical command names mapped to an array of its aliases\n */\nexport const commandAliases = Object.entries(aliases).reduce(\n (acc, [alias, canonical]) => {\n const commandAliases = acc.get(canonical)\n if (commandAliases) {\n commandAliases.push(alias)\n } else {\n acc.set(canonical, [alias])\n }\n return acc\n },\n new Map<string, string[]>(),\n)\n\nexport type Commands = typeof commands\n\nexport const getCommand = (\n s?: string,\n): Commands[keyof Commands] | undefined =>\n s && s in commands ? commands[s as keyof Commands] : undefined\n\nconst xdg = new XDG('vlt')\nconst cacheDir = xdg.cache()\n\n/**\n * Fields that are parsed as a set of key=value pairs\n */\nexport const recordFields = [\n 'git-hosts',\n 'registries',\n 'git-host-archives',\n 'scope-registries',\n 'jsr-registries',\n] as const\n\nexport type RecordField = (typeof recordFields)[number]\n\nexport const isRecordField = (s: string): s is RecordField =>\n recordFields.includes(s as RecordField)\n\nconst stopParsingCommands: Commands[keyof Commands][] = [\n 'run',\n 'run-exec',\n 'exec-local',\n 'exec',\n]\n\nlet stopParsing: boolean | undefined = undefined\n\nconst j = jack({\n envPrefix: 'VLT',\n allowPositionals: true,\n usage: `vlt [<options>] [<cmd> [<args> ...]]`,\n stopAtPositionalTest: arg => {\n if (stopParsing) return true\n const a = arg as keyof Commands\n // we stop parsing AFTER the thing, so you can do\n // vlt run --vlt --configs scriptName --args --for --script\n // or\n // vlt exec --vlt --configs command --args --for --command\n if (stopParsingCommands.includes(commands[a])) {\n stopParsing = true\n }\n return false\n },\n})\n .heading('vlt')\n .description(\n `More documentation available at <https://docs.vlt.sh>`,\n )\n .heading('Subcommands')\n\nj.description(Object.keys(canonicalCommands).join(', '), {\n pre: true,\n}).description(\n 'Run `vlt <cmd> --help` for more information about a specific command',\n)\n\nexport const definition = j\n /**\n * Definition of all configuration values used by vlt.\n */\n .heading('Configuration')\n .description(\n `If a \\`vlt.json\\` file is present in the root of the current project,\n then that will be used as a source of configuration information.\n\n Next, the \\`vlt.json\\` file in the XDG specified config directory\n will be checked, and loaded for any fields not set in the local project.\n\n Object type values will be merged together. Set a field to \\`null\\` in\n the JSON configuration to explicitly remove it.\n\n Command-specific fields may be set in a nested \\`command\\` object that\n overrides any options defined at the top level.\n `,\n )\n\n .flag({\n color: {\n short: 'c',\n description: 'Use colors (Default for TTY)',\n },\n 'no-color': {\n short: 'C',\n description: 'Do not use colors (Default for non-TTY)',\n },\n })\n\n .opt({\n registry: {\n hint: 'url',\n default: 'https://registry.npmjs.org/',\n description: `Sets the registry for fetching packages, when no registry\n is explicitly set on a specifier.\n\n For example, \\`express@latest\\` will be resolved by looking\n up the metadata from this registry.\n\n Note that alias specifiers starting with \\`npm:\\` will\n still map to \\`https://registry.npmjs.org/\\` if this is\n changed, unless the a new mapping is created via the\n \\`--registries\\` option.\n `,\n },\n })\n\n .optList({\n registries: {\n hint: 'name=url',\n description: `Specify named registry hosts by their prefix. To set the\n default registry used for non-namespaced specifiers,\n use the \\`--registry\\` option.\n\n Prefixes can be used as a package alias. For example:\n\n \\`\\`\\`\n vlt --registries loc=http://reg.local install foo@loc:foo@1.x\n \\`\\`\\`\n\n By default, the public npm registry is registered to the\n \\`npm:\\` prefix. It is not recommended to change this\n mapping in most cases.\n `,\n },\n\n 'scope-registries': {\n hint: '@scope=url',\n description: `Map package name scopes to registry URLs.\n\n For example,\n \\`--scope-registries @acme=https://registry.acme/\\`\n would tell vlt to fetch any packages named\n \\`@acme/...\\` from the \\`https://registry.acme/\\`\n registry.\n\n Note: this way of specifying registries is more ambiguous,\n compared with using the \\`--registries\\` field and explicit\n prefixes, because instead of failing when the configuration\n is absent, it will instead attempt to fetch from the\n default registry.\n\n By comparison, using\n \\`--registries acme=https://registry.acme/\\` and then\n specifying dependencies such as \\`\"foo\": \"acme:foo@1.x\"\\`\n means that regardless of the name, the package will be\n fetched from the explicitly named registry, or fail if\n no registry is defined with that name.\n\n However, custom registry aliases are not supported by other\n package managers.`,\n },\n\n 'jsr-registries': {\n hint: 'name=url',\n description: `Map alias names to JSR.io registry urls.\n\n For example,\n \\`--jsr-registries acme=https://jsr.acme.io/\\` would\n tell vlt to fetch any packages with the \\`acme:\\` registry\n prefix from the \\`https://jsr.acme.io/\\` registry, using\n the \"npm Compatibility\" translation. So for example,\n the package \\`acme:@foo/bar\\` would fetch the\n \\`@jsr/foo__bar\\` package from the \\`jsr.acme.io\\`\n registry.\n\n By default the \\`jsr\\` alias is always mapped to\n \\`https://npm.jsr.io/\\`, so existing \\`jsr:\\` packages will\n be fetched from the public \\`jsr\\` registry appropriately.\n `,\n },\n\n 'git-hosts': {\n hint: `name=template`,\n short: 'G',\n description: `Map a shorthand name to a git remote URL template.\n\n The \\`template\\` may contain placeholders, which will be\n swapped with the relevant values.\n\n \\`$1\\`, \\`$2\\`, etc. are replaced with the appropriate\n n-th path portion. For example, \\`github:user/project\\`\n would replace the \\`$1\\` in the template with \\`user\\`,\n and \\`$2\\` with \\`project\\`.`,\n },\n\n 'git-host-archives': {\n hint: `name=template`,\n short: 'A',\n description: `Similar to the \\`--git-host <name>=<template>\\` option,\n this option can define a template string that will be\n expanded to provide the URL to download a pre-built\n tarball of the git repository.\n\n In addition to the n-th path portion expansions performed\n by \\`--git-host\\`, this field will also expand the\n string \\`$committish\\` in the template, replacing it with\n the resolved git committish value to be fetched.`,\n },\n })\n\n .opt({\n cache: {\n hint: 'path',\n description: `\n Location of the vlt on-disk cache. Defaults to the platform-specific\n directory recommended by the XDG specification.\n `,\n default: cacheDir,\n },\n tag: {\n description: `Default \\`dist-tag\\` to install or publish`,\n default: 'latest',\n },\n before: {\n hint: 'date',\n description: `Do not install any packages published after this date`,\n },\n os: {\n description: `The operating system to use as the selector when choosing\n packages based on their \\`os\\` value.`,\n default: process.platform,\n },\n arch: {\n description: `CPU architecture to use as the selector when choosing\n packages based on their \\`cpu\\` value.`,\n default: process.arch,\n },\n libc: {\n description: `Override the libc family to use as the selector when choosing\n packages based on their \\`libc\\` value (e.g. glibc, musl).\n By default, this is auto-detected on Linux systems.`,\n },\n 'node-version': {\n hint: 'version',\n description: `Node version to use when choosing packages based on\n their \\`engines.node\\` value.`,\n default: process.version,\n },\n })\n\n .flag({\n 'git-shallow': {\n description: `Set to force \\`--depth=1\\` on all git clone actions.\n When set explicitly to false with --no-git-shallow,\n then \\`--depth=1\\` will not be used.\n\n When not set explicitly, \\`--depth=1\\` will be used for\n git hosts known to support this behavior.`,\n },\n })\n .num({\n 'fetch-retries': {\n hint: 'n',\n description: `Number of retries to perform when encountering network\n errors or likely-transient errors from git hosts.`,\n default: 3,\n },\n 'fetch-retry-factor': {\n hint: 'n',\n description: `The exponential backoff factor to use when retrying\n requests due to network issues.`,\n default: 2,\n },\n 'fetch-retry-mintimeout': {\n hint: 'n',\n description: `Number of milliseconds before starting first retry`,\n default: 0,\n },\n 'fetch-retry-maxtimeout': {\n hint: 'n',\n description: `Maximum number of milliseconds between two retries`,\n default: 30_000,\n },\n 'stale-while-revalidate-factor': {\n hint: 'n',\n default: 60,\n description: `If the server does not serve a \\`stale-while-revalidate\\`\n value in the \\`cache-control\\` header, then this multiplier\n is applied to the \\`max-age\\` or \\`s-maxage\\` values.\n\n By default, this is \\`60\\`, so for example a response that\n is cacheable for 5 minutes will allow a stale response\n while revalidating for up to 5 hours.\n\n If the server *does* provide a \\`stale-while-revalidate\\`\n value, then that is always used.\n\n Set to 0 to prevent any \\`stale-while-revalidate\\` behavior\n unless explicitly allowed by the server's \\`cache-control\\`\n header.\n `,\n },\n })\n\n .opt({\n identity: {\n short: 'i',\n validate: (v: unknown) =>\n typeof v === 'string' && /^[a-z0-9]*$/.test(v),\n hint: 'name',\n default: '',\n description: `Provide a string to define an identity for storing auth\n information when logging into registries.\n\n Authentication tokens will be stored in the XDG data\n directory, in \\`vlt/auth/$\\{identity}/keychain.json\\`.\n\n If no identity is provided, then the default \\`''\\` will\n be used, storing the file at \\`vlt/auth/keychain.json\\`.\n\n May only contain lowercase alphanumeric characters.\n `,\n },\n })\n\n .optList({\n workspace: {\n hint: 'ws',\n short: 'w',\n description: `Set to limit the spaces being worked on when working on\n workspaces.\n\n Can be paths or glob patterns matching paths.\n\n Specifying workspaces by package.json name is not\n supported.`,\n },\n 'workspace-group': {\n description: `Specify named workspace group names to load and operate on\n when doing recursive operations on workspaces.`,\n },\n })\n\n .opt({\n scope: {\n short: 's',\n hint: 'query',\n description:\n 'Set to filter the scope of an operation using a DSS Query.',\n },\n target: {\n short: 't',\n hint: 'query',\n description:\n 'Set to select packages using a DSS Query selector.',\n },\n })\n\n .flag({\n 'if-present': {\n description: `When running scripts across multiple packages,\n only include packages that have the script.\n\n If this is not set, then the run will fail if any\n packages do not have the script.\n\n This will default to true if --scope, --workspace,\n --workspace-group, or --recursive is set. Otherwise,\n it will default to false.`,\n },\n })\n\n .flag({\n recursive: {\n short: 'r',\n description: `Run an operation across multiple workspaces.\n\n No effect when used in non-monorepo projects.\n\n Implied by setting --workspace or --workspace-group. If\n not set, then the action is run on the project root.`,\n },\n\n bail: {\n short: 'b',\n description: `When running scripts across multiple workspaces, stop\n on the first failure.`,\n default: true,\n },\n\n 'no-bail': {\n short: 'B',\n description: `When running scripts across multiple workspaces, continue\n on failure, running the script for all workspaces.`,\n },\n })\n\n .opt({\n config: {\n hint: 'all | user | project',\n description: `Specify which configuration to show or operate on when running\n \\`vlt config\\` commands. For read operations (get, pick, list):\n \\`all\\` shows merged configuration from both user and project\n files (default). For write operations (set, delete, edit):\n defaults to \\`project\\`. \\`user\\` shows/modifies only user-level\n configuration, \\`project\\` shows/modifies only project-level\n configuration.`,\n validOptions: ['all', 'user', 'project'] as const,\n default: 'all',\n },\n\n editor: {\n hint: 'program',\n description: `The blocking editor to use for \\`vlt config edit\\` and\n any other cases where a file should be opened for\n editing.\n\n Defaults to the \\`EDITOR\\` or \\`VISUAL\\` env if set, or\n \\`notepad.exe\\` on Windows, or \\`vi\\` elsewhere.`,\n default: defaultEditor(),\n },\n\n 'script-shell': {\n hint: 'program',\n description: `The shell to use when executing \\`package.json#scripts\\`.\n\n For \\`vlt exec\\` and \\`vlt exec-local\\`, this is never set,\n meaning that command arguments are run exactly as provided.\n\n For \\`vlt run\\` (and other things that run lifecycle\n scripts in \\`package.json#scripts\\`), the entire command\n with all arguments is provided as a single string, meaning\n that some value must be provided for shell interpretation,\n and so for these contexts, the \\`script-shell\\` value will\n default to \\`/bin/sh\\` on POSIX systems or \\`cmd.exe\\` on\n Windows.\n `,\n },\n\n 'fallback-command': {\n hint: 'command',\n description: `The command to run when the first argument doesn't\n match any known commands.\n\n For pnpm-style behavior, set this to 'run-exec'. e.g:\n \\`\\`\\`\n vlt config set fallback-command=run-exec\n \\`\\`\\``,\n default: 'help',\n validOptions: Object.keys(canonicalCommands),\n },\n })\n\n .opt({\n package: {\n hint: 'p',\n description: `When running \\`vlt exec\\`, this allows you to explicitly\n set the package to search for bins. If not provided, then\n vlt will interpret the first argument as the package, and\n attempt to run the default executable.`,\n },\n })\n\n .opt({\n view: {\n hint: 'output',\n default: defaultView,\n description: `Configures the output format for commands.\n\n Defaults to \\`human\\` if stdout is a TTY, or \\`json\\`\n if it is not.\n\n - human: Maximally ergonomic output reporting for human\n consumption.\n - json: Parseable JSON output for machines.\n - inspect: Output results with \\`util.inspect\\`.\n - gui: Start a local web server and opens a browser to\n explore the results. (Only relevant for certain\n commands.)\n - mermaid: Output mermaid diagramming syntax. (Only\n relevant for certain commands.)\n - silent: Suppress all output to stdout.\n\n If the requested view format is not supported for the\n current command, or if no option is provided, then it\n will fall back to the default.\n `,\n validOptions: [\n 'human',\n 'json',\n 'mermaid',\n 'gui',\n 'inspect',\n 'silent',\n ] as const,\n },\n })\n\n .optList({\n 'dashboard-root': {\n hint: 'path',\n description: `The root directory to use for the dashboard browser-based UI.\n If not set, the user home directory is used.`,\n },\n })\n\n .flag({\n 'save-dev': {\n short: 'D',\n description: `Save installed packages to a package.json file as\n devDependencies`,\n },\n 'save-optional': {\n short: 'O',\n description: `Save installed packages to a package.json file as\n optionalDependencies`,\n },\n 'save-peer': {\n description: `Save installed packages to a package.json file as\n peerDependencies`,\n },\n 'save-prod': {\n short: 'P',\n description: `Save installed packages into dependencies specifically.\n This is useful if a package already exists in\n devDependencies or optionalDependencies, but you want to\n move it to be a non-optional production dependency.`,\n },\n })\n\n .opt({\n 'expect-results': {\n hint: 'value',\n validate: (v: unknown) =>\n typeof v === 'string' && /^([<>]=?)?[0-9]+$/.test(v),\n description: `When running \\`vlt query\\`, this option allows you to\n set a expected number of resulting items.\n\n Accepted values are numbers and strings.\n\n Strings starting with \\`>\\`, \\`<\\`, \\`>=\\` or \\`<=\\`\n followed by a number can be used to check if the result\n is greater than or less than a specific number.`,\n },\n })\n\n .flag({\n 'dry-run': {\n description: 'Run command without making any changes',\n },\n 'expect-lockfile': {\n description:\n 'Fail if lockfile is missing or out of date. Used by ci command to enforce lockfile integrity.',\n },\n 'frozen-lockfile': {\n description:\n 'Fail if lockfile is missing or out of sync with package.json. Prevents any lockfile modifications.',\n },\n 'lockfile-only': {\n description:\n 'Only update the lockfile (vlt-lock.json) and package.json files, skip all node_modules operations including package extraction and filesystem changes.',\n },\n })\n .opt({\n 'allow-scripts': {\n hint: 'query',\n description: `Filter which packages are allowed to run lifecycle scripts using DSS query syntax.\n When provided, only packages matching the query will execute their\n install, preinstall, postinstall, prepare, preprepare, and postprepare scripts.\n Defaults to ':not(*)' which means no scripts will be run.\n \n Example: --allow-scripts=\":root > *, #my-package\"\n Runs scripts only for direct dependencies of the current project and any occurrences\n of a specific dependency with the name \"my-package\" anywhere in the dependency graph.`,\n },\n })\n .opt({\n access: {\n description: 'Set the access level of the package',\n validOptions: ['public', 'restricted'] as const,\n default: 'public',\n },\n })\n .opt({\n otp: {\n description: `Provide an OTP to use when publishing a package.`,\n },\n 'publish-directory': {\n hint: 'path',\n description: `Directory to use for pack and publish operations instead of the current directory.\n The directory must exist and nothing will be copied to it.`,\n },\n port: {\n hint: 'number',\n description: `Port for the browser-based UI server when using vlt serve command (default: 8000).`,\n },\n 'registry-port': {\n hint: 'number',\n description: `Port for the VSR registry when using vlt serve command (default: 1337).`,\n },\n })\n\n .flag({\n yes: {\n short: 'y',\n description: `Automatically accept any confirmation prompts`,\n },\n version: {\n short: 'v',\n description: 'Print the version',\n },\n help: {\n short: 'h',\n description: 'Print helpful information',\n },\n all: {\n short: 'a',\n description: 'Show all commands, bins, and flags',\n },\n })\n\nexport const getSortedCliOptions = () => {\n const defs = definition.toJSON()\n return getSortedKeys().map((k: keyof typeof defs) => {\n const def = defs[k]\n /* c8 ignore next */\n if (!def) throw error('invalid key found', { found: k })\n if (def.type === 'boolean') return `--${k}`\n return `--${k}=<${def.hint ?? k}>`\n })\n}\n\nexport const getSortedKeys = () =>\n Object.keys(definition.toJSON()).sort((a, b) => a.localeCompare(b))\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vltpkg/cli-sdk",
|
|
3
3
|
"description": "The source for the vlt CLI",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.14",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/vltpkg/vltpkg.git",
|
|
@@ -28,31 +28,31 @@
|
|
|
28
28
|
"ssri": "^13.0.0",
|
|
29
29
|
"supports-color": "^10.2.2",
|
|
30
30
|
"tar": "^7.5.2",
|
|
31
|
-
"@vltpkg/
|
|
32
|
-
"@vltpkg/
|
|
33
|
-
"@vltpkg/
|
|
34
|
-
"@vltpkg/
|
|
35
|
-
"@vltpkg/graph
|
|
36
|
-
"@vltpkg/
|
|
37
|
-
"@vltpkg/
|
|
38
|
-
"@vltpkg/
|
|
39
|
-
"@vltpkg/
|
|
40
|
-
"@vltpkg/
|
|
41
|
-
"@vltpkg/
|
|
42
|
-
"@vltpkg/
|
|
43
|
-
"@vltpkg/query": "1.0.0-rc.
|
|
44
|
-
"@vltpkg/registry-client": "1.0.0-rc.
|
|
45
|
-
"@vltpkg/
|
|
46
|
-
"@vltpkg/
|
|
47
|
-
"@vltpkg/security-archive": "1.0.0-rc.
|
|
48
|
-
"@vltpkg/server": "1.0.0-rc.
|
|
49
|
-
"@vltpkg/
|
|
50
|
-
"@vltpkg/
|
|
51
|
-
"@vltpkg/vlt-json": "1.0.0-rc.
|
|
52
|
-
"@vltpkg/
|
|
53
|
-
"@vltpkg/
|
|
54
|
-
"@vltpkg/workspaces": "1.0.0-rc.
|
|
55
|
-
"@vltpkg/xdg": "1.0.0-rc.
|
|
31
|
+
"@vltpkg/dep-id": "1.0.0-rc.14",
|
|
32
|
+
"@vltpkg/dot-prop": "1.0.0-rc.14",
|
|
33
|
+
"@vltpkg/config": "1.0.0-rc.14",
|
|
34
|
+
"@vltpkg/error-cause": "1.0.0-rc.14",
|
|
35
|
+
"@vltpkg/graph": "1.0.0-rc.14",
|
|
36
|
+
"@vltpkg/init": "1.0.0-rc.14",
|
|
37
|
+
"@vltpkg/git": "1.0.0-rc.14",
|
|
38
|
+
"@vltpkg/output": "1.0.0-rc.14",
|
|
39
|
+
"@vltpkg/graph-run": "1.0.0-rc.14",
|
|
40
|
+
"@vltpkg/package-json": "1.0.0-rc.14",
|
|
41
|
+
"@vltpkg/package-info": "1.0.0-rc.14",
|
|
42
|
+
"@vltpkg/promise-spawn": "1.0.0-rc.14",
|
|
43
|
+
"@vltpkg/query": "1.0.0-rc.14",
|
|
44
|
+
"@vltpkg/registry-client": "1.0.0-rc.14",
|
|
45
|
+
"@vltpkg/rollback-remove": "1.0.0-rc.14",
|
|
46
|
+
"@vltpkg/run": "1.0.0-rc.14",
|
|
47
|
+
"@vltpkg/security-archive": "1.0.0-rc.14",
|
|
48
|
+
"@vltpkg/server": "1.0.0-rc.14",
|
|
49
|
+
"@vltpkg/url-open": "1.0.0-rc.14",
|
|
50
|
+
"@vltpkg/spec": "1.0.0-rc.14",
|
|
51
|
+
"@vltpkg/vlt-json": "1.0.0-rc.14",
|
|
52
|
+
"@vltpkg/vlx": "1.0.0-rc.14",
|
|
53
|
+
"@vltpkg/types": "1.0.0-rc.14",
|
|
54
|
+
"@vltpkg/workspaces": "1.0.0-rc.14",
|
|
55
|
+
"@vltpkg/xdg": "1.0.0-rc.14"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@eslint/js": "^9.39.1",
|