vlt 0.0.0-3 → 0.0.0-4

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.
Files changed (125) hide show
  1. package/README.md +2 -1
  2. package/package.json +17 -10
  3. package/postinstall.cjs +56 -0
  4. package/vlix +25 -0
  5. package/vlr +25 -0
  6. package/vlrx +25 -0
  7. package/vlt +25 -0
  8. package/vlx +25 -0
  9. package/cache-unzip-src-unzip.js +0 -7896
  10. package/cache-unzip-src-unzip.js.map +0 -7
  11. package/chunk-227OF2U2.js +0 -1183
  12. package/chunk-227OF2U2.js.map +0 -7
  13. package/chunk-3HXIYJS2.js +0 -54
  14. package/chunk-3HXIYJS2.js.map +0 -7
  15. package/chunk-AA6MVXJX.js +0 -19823
  16. package/chunk-AA6MVXJX.js.map +0 -7
  17. package/chunk-BCK4ZGNG.js +0 -41
  18. package/chunk-BCK4ZGNG.js.map +0 -7
  19. package/chunk-DH36SF3E.js +0 -35
  20. package/chunk-DH36SF3E.js.map +0 -7
  21. package/chunk-FNKWJ7AZ.js +0 -1379
  22. package/chunk-FNKWJ7AZ.js.map +0 -7
  23. package/chunk-H77UDCL3.js +0 -9820
  24. package/chunk-H77UDCL3.js.map +0 -7
  25. package/chunk-HL76E44L.js +0 -73
  26. package/chunk-HL76E44L.js.map +0 -7
  27. package/chunk-IN7DEH7F.js +0 -44
  28. package/chunk-IN7DEH7F.js.map +0 -7
  29. package/chunk-JLP2QDXQ.js +0 -1137
  30. package/chunk-JLP2QDXQ.js.map +0 -7
  31. package/chunk-JMGSFQ32.js +0 -969
  32. package/chunk-JMGSFQ32.js.map +0 -7
  33. package/chunk-JQRUGUZ3.js +0 -512
  34. package/chunk-JQRUGUZ3.js.map +0 -7
  35. package/chunk-K2BYYPM7.js +0 -8656
  36. package/chunk-K2BYYPM7.js.map +0 -7
  37. package/chunk-LNUDEBGP.js +0 -2071
  38. package/chunk-LNUDEBGP.js.map +0 -7
  39. package/chunk-MV5ZQ3LW.js +0 -1105
  40. package/chunk-MV5ZQ3LW.js.map +0 -7
  41. package/chunk-O7CDQZDW.js +0 -5234
  42. package/chunk-O7CDQZDW.js.map +0 -7
  43. package/chunk-OFW7MWFP.js +0 -82
  44. package/chunk-OFW7MWFP.js.map +0 -7
  45. package/chunk-PGDJ2ZZ6.js +0 -4810
  46. package/chunk-PGDJ2ZZ6.js.map +0 -7
  47. package/chunk-POVPHE2F.js +0 -1864
  48. package/chunk-POVPHE2F.js.map +0 -7
  49. package/chunk-PTVPYZHU.js +0 -72
  50. package/chunk-PTVPYZHU.js.map +0 -7
  51. package/chunk-SXBMMXTY.js +0 -11837
  52. package/chunk-SXBMMXTY.js.map +0 -7
  53. package/chunk-UZZ72UON.js +0 -152
  54. package/chunk-UZZ72UON.js.map +0 -7
  55. package/chunk-V7KRP7IO.js +0 -481
  56. package/chunk-V7KRP7IO.js.map +0 -7
  57. package/chunk-WVNUD273.js +0 -83
  58. package/chunk-WVNUD273.js.map +0 -7
  59. package/chunk-WYPE3MV4.js +0 -62
  60. package/chunk-WYPE3MV4.js.map +0 -7
  61. package/chunk-ZRNJWPYC.js +0 -37
  62. package/chunk-ZRNJWPYC.js.map +0 -7
  63. package/cli-package.json +0 -107
  64. package/config-3QQHUYLI.js +0 -179
  65. package/config-3QQHUYLI.js.map +0 -7
  66. package/devtools-5BBQJTDW.js +0 -16682
  67. package/devtools-5BBQJTDW.js.map +0 -7
  68. package/exec-C6GK336U.js +0 -50
  69. package/exec-C6GK336U.js.map +0 -7
  70. package/gui-IQ4M4K5X.js +0 -46
  71. package/gui-IQ4M4K5X.js.map +0 -7
  72. package/gui-assets/favicon.ico +0 -0
  73. package/gui-assets/fonts/geist-mono.ttf +0 -0
  74. package/gui-assets/fonts/inter.ttf +0 -0
  75. package/gui-assets/images/folder.png +0 -0
  76. package/gui-assets/index.html +0 -34
  77. package/gui-assets/index.js +0 -1549
  78. package/gui-assets/index.js.map +0 -7
  79. package/gui-assets/main.css +0 -1
  80. package/help-R6TSKVEA.js +0 -25
  81. package/help-R6TSKVEA.js.map +0 -7
  82. package/init-UTJGYULC.js +0 -25
  83. package/init-UTJGYULC.js.map +0 -7
  84. package/install-5XDTGLAU.js +0 -56
  85. package/install-5XDTGLAU.js.map +0 -7
  86. package/install-exec-VMPN3JE7.js +0 -28
  87. package/install-exec-VMPN3JE7.js.map +0 -7
  88. package/list-Q7IANZ3I.js +0 -129
  89. package/list-Q7IANZ3I.js.map +0 -7
  90. package/login-VHJEIRVU.js +0 -36
  91. package/login-VHJEIRVU.js.map +0 -7
  92. package/logout-5KMCSSR4.js +0 -36
  93. package/logout-5KMCSSR4.js.map +0 -7
  94. package/pkg-WYFDWETL.js +0 -364
  95. package/pkg-WYFDWETL.js.map +0 -7
  96. package/query-KP4F5D2Y.js +0 -117
  97. package/query-KP4F5D2Y.js.map +0 -7
  98. package/registry-client-package.json +0 -85
  99. package/reporter-LFGXWL6N.js +0 -18
  100. package/reporter-LFGXWL6N.js.map +0 -7
  101. package/rollback-remove-src-remove.js +0 -7398
  102. package/rollback-remove-src-remove.js.map +0 -7
  103. package/run-XNDZH72D.js +0 -68
  104. package/run-XNDZH72D.js.map +0 -7
  105. package/run-exec-NXA33NXJ.js +0 -41
  106. package/run-exec-NXA33NXJ.js.map +0 -7
  107. package/source-JWPG6PR3.js +0 -33
  108. package/source-JWPG6PR3.js.map +0 -7
  109. package/token-6IJNGEMI.js +0 -86
  110. package/token-6IJNGEMI.js.map +0 -7
  111. package/uninstall-MI7NFD27.js +0 -45
  112. package/uninstall-MI7NFD27.js.map +0 -7
  113. package/vlix.js +0 -25
  114. package/vlix.js.map +0 -7
  115. package/vlr.js +0 -25
  116. package/vlr.js.map +0 -7
  117. package/vlrx.js +0 -25
  118. package/vlrx.js.map +0 -7
  119. package/vlt.js +0 -24
  120. package/vlt.js.map +0 -7
  121. package/vlx.js +0 -25
  122. package/vlx.js.map +0 -7
  123. package/whoami-3IEXJF3U.js +0 -46
  124. package/whoami-3IEXJF3U.js.map +0 -7
  125. package/yoga.wasm +0 -0
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/dep-id/src/index.ts", "../../../src/workspaces/src/index.ts", "../../../node_modules/.pnpm/graph-run@1.0.4/node_modules/graph-run/src/index.ts", "../../../node_modules/.pnpm/walk-up-path@4.0.0/node_modules/walk-up-path/src/index.ts"],
4
- "sourcesContent": ["import { error } from '@vltpkg/error-cause'\nimport { Spec } from '@vltpkg/spec'\nimport type { SpecOptions } from '@vltpkg/spec'\nimport type { Manifest } from '@vltpkg/types'\n\nexport const delimiter: Delimiter = '\u00B7'\nexport type Delimiter = '\u00B7'\n\n/**\n * Dependency IDs are a URI-encoded set of strings, separated\n * by the {@link Delimiter} character (`'\u00B7'`).\n *\n * The first entry is always the specifier type. The rest depend on the\n * type. `git`, `registry`, and `workspace` entries have 3 fields, the rest\n * have 2.\n *\n * - `registry`: `'registry\u00B7<registry>\u00B7name@specifier'`\n * The `<registry>` portion can be a known named registry name, or a\n * url to a registry. If empty, it is the default registry. Examples:\n * - `\u00B7\u00B7some-package@2.0.1`\n * - `\u00B7npm\u00B7whatever@1.2.3`\n * - `\u00B7http%3A%2F%2Fvlt.sh%2F\u00B7x@1.2.3`\n * - `git`: `'git\u00B7<git remote>\u00B7<git selector>'`. For example:\n * - `git\u00B7github:user/project\u00B7branchname`\n * - `git\u00B7git%2Bssh%3A%2F%2Fuser%40host%3Aproject.git\u00B7semver:1.x`\n * - `workspace`: `'workspace\u00B7<path>'`. For example:\n * - `workspace\u00B7src/mything`\n * - `remote`: `'remote\u00B7<url>'`\n * - `file`: `'file\u00B7<path>'`\n *\n * Lastly, the final portion can contain arbitrary string data, and is\n * used to store peer dep resolutions to maintain the peerDep contract.\n */\nexport type DepID =\n | `${'' | 'git'}${Delimiter}${string}${Delimiter}${string}${Delimiter}${string}`\n | `${'' | 'git'}${Delimiter}${string}${Delimiter}${string}`\n | `${'file' | 'remote' | 'workspace'}${Delimiter}${string}${Delimiter}${string}`\n | `${'file' | 'remote' | 'workspace'}${Delimiter}${string}`\n\n/**\n * A {@link DepID}, split apart and URI-decoded\n */\nexport type DepIDTuple =\n | [\n type: 'git',\n gitRemote: string,\n gitSelector: string,\n extra?: string,\n ]\n | [\n type: 'registry',\n registry: string,\n registrySpec: string,\n extra?: string,\n ]\n | [type: 'file', path: string, extra?: string]\n | [type: 'remote', url: string, extra?: string]\n | [type: 'workspace', workspace: string, extra?: string]\n\nconst depIDRegExp = new RegExp(\n `^((git)?${delimiter}[^${delimiter}]*${delimiter}[^${delimiter}]*(${\n delimiter\n }[^${delimiter}]*)?$` +\n `|` +\n `^(file|remote|workspace)${delimiter}[^${\n delimiter\n }]*)(${delimiter}[^${delimiter}]*)?$`,\n)\n\nexport const isDepID = (str: unknown): str is DepID =>\n typeof str === 'string' && depIDRegExp.test(str)\n\nexport const asDepID = (str: string): DepID => {\n if (!isDepID(str)) {\n throw error('Expected dep id', {\n found: str,\n })\n }\n return str\n}\n\n/**\n * turn a {@link DepIDTuple} into a {@link DepID}\n */\nexport const joinDepIDTuple = (list: DepIDTuple): DepID => {\n const [type, first, second, extra] = list\n const f = encode(first)\n switch (type) {\n case 'registry':\n return `${delimiter}${f}${delimiter}${encode(second)}${extra ? `${delimiter}${encode(extra)}` : ''}`\n case 'git':\n return `${type}${delimiter}${f}${delimiter}${encode(second)}${extra ? `${delimiter}${encode(extra)}` : ''}`\n default:\n return `${type}${delimiter}${f}${second ? `${delimiter}${encode(second)}` : ''}`\n }\n}\n\n// allow @, but otherwise, escape everything urls do\nconst encode = (s: string): string =>\n encodeURIComponent(s)\n .replaceAll('%40', '@')\n .replaceAll('%2f', '\u00A7')\n .replaceAll('%2F', '\u00A7')\n\n/**\n * turn a {@link DepID} into a {@link DepIDTuple}\n */\nexport const splitDepID = (id: string): DepIDTuple => {\n const [type, first = '', second, extra] = id\n .replaceAll('\u00A7', '/')\n .split(delimiter, 4)\n const f = decodeURIComponent(first)\n switch (type) {\n case 'git':\n case '': {\n if (second === undefined) {\n throw error(`invalid ${type} id`, { found: id })\n }\n const t: DepIDTuple = [\n type || 'registry',\n f,\n decodeURIComponent(second),\n ]\n if (extra) t.push(decodeURIComponent(extra))\n return t\n }\n case 'file':\n case 'remote':\n case 'workspace': {\n const t: DepIDTuple = [type, f]\n if (second) t.push(decodeURIComponent(second))\n return t\n }\n default: {\n throw error('invalid DepID type', {\n found: type,\n validOptions: ['git', 'file', 'workspace', 'remote', ''],\n })\n }\n }\n}\n\n/**\n * Turn a {@link DepID} into a {@link Spec} object\n */\nexport const hydrate = (\n id: DepID,\n name?: string,\n options: SpecOptions = {},\n): Spec => hydrateTuple(splitDepID(id), name, options)\n\n/**\n * Turn a {@link DepIDTuple} into a {@link Spec} object\n */\nexport const hydrateTuple = (\n tuple: DepIDTuple,\n name?: string,\n options: SpecOptions = {},\n) => {\n const [type, first, second] = tuple\n switch (type) {\n case 'remote': {\n if (!first)\n throw error('no remoteURL found on remote id', {\n found: tuple,\n })\n return Spec.parse(name ?? '(unknown)', first)\n }\n case 'file': {\n if (!first) {\n throw error('no file path found on remote id', {\n found: tuple,\n })\n }\n return Spec.parse(name ?? '(unknown)', `file:${first}`, options)\n }\n case 'registry': {\n if (typeof first !== 'string') {\n throw error('no registry url or name in registry ID', {\n found: tuple,\n })\n }\n if (!second) {\n throw error('no name/specifier in registry ID', {\n found: tuple,\n })\n }\n if (!first) {\n // just a normal name@version on the default registry\n const s = Spec.parse(second)\n if (name && s.name !== name) {\n return Spec.parse(`${name}@npm:${second}`)\n } else {\n return s\n }\n }\n if (!/^https?:\\/\\//.test(first)) {\n const reg = options.registries?.[first]\n if (first !== 'npm' && !reg) {\n throw error('named registry not found in options', {\n name: first,\n found: tuple,\n })\n }\n return Spec.parse(\n name ?? '(unknown)',\n `${first}:${second}`,\n options,\n )\n }\n const s = Spec.parse(\n name ?? '(unknown)',\n `registry:${first}#${second}`,\n options,\n )\n return name && s.final.name !== name ?\n Spec.parse(s.final.name + '@' + s.bareSpec)\n : s\n }\n case 'git': {\n if (!first) {\n throw error('no git remote in git ID', {\n found: tuple,\n })\n }\n return Spec.parse(\n name ?? '(unknown)',\n first + '#' + second,\n options,\n )\n }\n case 'workspace': {\n if (!first) {\n throw error('no name/path on workspace id', { found: tuple })\n }\n return name && name !== first ?\n Spec.parse(name, `workspace:${first}@*`, options)\n : Spec.parse(first, `workspace:*`, options)\n }\n }\n}\n\n// Strip out the default registry, there's no need to store that\nconst omitDefReg = (s?: string): string =>\n (\n !s ||\n s === 'https://registry.npmjs.org' ||\n s === 'https://registry.npmjs.org/'\n ) ?\n ''\n : s\n\n/**\n * Get the {@link DepIDTuple} for a given {@link Spec} and {@link Manifest}.\n * The Manifest is used to get the name and version, if possible. If not found\n * in the manifest, registry ID types will use the name or bareSpec from the\n * specifier, so at least there's something to use later.\n */\nexport const getTuple = (spec: Spec, mani: Manifest): DepIDTuple => {\n const f = spec.final\n switch (f.type) {\n case 'registry': {\n // try to shorten to a known name if we can.\n const reg = omitDefReg(f.registry)\n if (!f.namedRegistry && reg) {\n for (const [alias, host] of Object.entries(\n spec.options.registries,\n )) {\n if (reg === host) {\n f.namedRegistry = alias\n break\n }\n }\n }\n return [\n f.type,\n f.namedRegistry ?? reg,\n `${mani.name ?? spec.name}@${mani.version ?? spec.bareSpec}`,\n ]\n }\n case 'git': {\n const {\n namedGitHost,\n namedGitHostPath,\n gitRemote,\n gitSelector = '',\n } = f\n if (!gitRemote)\n throw error('no host on git specifier', { spec })\n if (namedGitHost) {\n if (!namedGitHostPath) {\n throw error('named git host without path portion', {\n spec,\n })\n }\n return [\n f.type,\n `${namedGitHost}:${namedGitHostPath}`,\n gitSelector,\n ]\n } else {\n return [f.type, gitRemote, gitSelector]\n }\n }\n case 'remote': {\n const { remoteURL } = f\n if (!remoteURL)\n throw error('no URL on remote specifier', { spec })\n return [f.type, remoteURL]\n }\n case 'file':\n case 'workspace':\n throw error('Path-based dep ids are not supported', { spec })\n }\n}\n\n/**\n * Get the {@link DepID} for a given {@link Spec} and {@link Manifest}. The\n * Manifest is used to get the name and version, if possible. If not found in\n * the manifest, registry ID types will use the name or bareSpec from the\n * specifier, so at least there's something to use later.\n */\nexport const getId = (spec: Spec, mani: Manifest): DepID =>\n joinDepIDTuple(getTuple(spec, mani))\n", "import { joinDepIDTuple } from '@vltpkg/dep-id'\nimport type { DepID } from '@vltpkg/dep-id'\nimport { error } from '@vltpkg/error-cause'\nimport { PackageJson } from '@vltpkg/package-json'\nimport type { Manifest } from '@vltpkg/types'\nimport { readFileSync, statSync } from 'fs'\nimport { globSync } from 'glob'\nimport type { GlobOptionsWithFileTypesFalse } from 'glob'\nimport { graphRun, graphRunSync } from 'graph-run'\nimport type { DepResults } from 'graph-run'\nimport { basename, resolve, posix } from 'path'\nimport { PathScurry } from 'path-scurry'\nimport type { Path } from 'path-scurry'\nimport { parse } from 'polite-json'\nimport { minimatch } from 'minimatch'\n\nexport type WorkspacesLoadedConfig = {\n workspace?: string[]\n 'workspace-group'?: string[]\n}\n\n/**\n * The object passed to the constructor or {@link Monorepo#load} to limit which\n * {@link Workspace Workspaces} get loaded.\n */\nexport type LoadQuery = {\n /**\n * A glob pattern string, or an array of them. Only workspaces found\n * in paths matched will be loaded.\n */\n paths?: string[] | string\n /**\n * A string, or an array of strings. If set, only workspaces in the\n * specified groups named will be included, if set.\n */\n groups?: string[] | string\n}\n\n/**\n * Canonical form of the {@link WorkspaceConfig}, used\n * internally for consistency.\n */\nexport type WorkspaceConfigObject = Record<string, string[]>\n\n/**\n * Allowed datatype in the `vlt-workspaces.json` file.\n */\nexport type WorkspaceConfig =\n | string[]\n | WorkspaceConfigObject\n | string\n\n/**\n * Turn a {@link WorkspaceConfig} into a\n * {@link WorkspaceConfigObject}, or throw if it's not valid.\n */\nexport const asWSConfig = (\n conf: unknown,\n path?: string,\n): WorkspaceConfigObject => {\n assertWSConfig(conf, path)\n return (\n typeof conf === 'string' ? { packages: [conf] }\n : Array.isArray(conf) ? { packages: conf }\n : conf\n )\n}\n\n/**\n * Throw if the provided value is not a valid {@link WorkspaceConfig}\n */\nexport const assertWSConfig: (\n conf: unknown,\n path?: string,\n) => asserts conf is WorkspaceConfig = (\n conf: unknown,\n path?: string,\n) => {\n if (typeof conf === 'string') return conf\n\n if (Array.isArray(conf)) {\n for (const c of conf) {\n if (typeof c !== 'string') {\n throw error('Invalid workspace definition', {\n path,\n found: c as unknown,\n wanted: 'string',\n })\n }\n }\n return\n }\n\n if (conf && typeof conf === 'object') {\n for (const [group, value] of Object.entries(conf)) {\n if (typeof value === 'string') continue\n if (Array.isArray(value)) {\n for (const c of value) {\n if (typeof c !== 'string') {\n throw error('Invalid workspace definition', {\n path,\n name: group,\n found: c as unknown,\n wanted: 'string',\n })\n }\n }\n continue\n }\n throw error('Invalid workspace definition', {\n path,\n name: group,\n found: value as unknown,\n wanted: 'string | string[]',\n })\n }\n return\n }\n\n throw error('Invalid workspace definition', {\n path,\n found: conf,\n wanted:\n 'string | string[] | { [group: string]: string | string[] }',\n })\n}\n\nexport type MonorepoOptions = {\n /**\n * A {@link PackageJson} object, for sharing manifest caches\n */\n packageJson?: PackageJson\n /**\n * A {@link PathScurry} object, for use in globs\n */\n scurry?: PathScurry\n /** Parsed normalized contents of a `vlt-workspaces.json` file */\n config?: WorkspaceConfigObject\n /**\n * If set, then {@link Monorepo#load} will be called immediately with\n * this argument.\n */\n load?: LoadQuery\n}\n\n/**\n * Class representing a Monorepo containing multiple workspaces.\n *\n * Does not automatically look up the root, but that can be provided by\n * running `Config.load()`, since it stops seeking the route when a\n * `vlt-workspaces.json` file is encountered.\n */\nexport class Monorepo {\n /** The project root where vlt-workspaces.json is found */\n projectRoot: string\n /** Scurry object to cache all filesystem calls (mostly globs) */\n scurry: PathScurry\n\n // maps both name and path to the workspace objects\n #workspaces = new Map<string, Workspace>()\n #groups = new Map<string, Set<Workspace>>()\n #config?: WorkspaceConfigObject\n packageJson: PackageJson\n\n /**\n * Number of {@link Workspace} objects loaded in this Monorepo\n */\n get size(): number {\n return [...this.values()].length\n }\n\n constructor(projectRoot: string, options: MonorepoOptions = {}) {\n this.projectRoot = resolve(projectRoot)\n this.scurry = options.scurry ?? new PathScurry(projectRoot)\n this.packageJson = options.packageJson ?? new PackageJson()\n this.#config = options.config\n if (options.load) this.load(options.load)\n }\n\n /**\n * Load the workspace definitions from vlt-workspaces.json,\n * canonicalizing the result into the effective `{[group:string]:string[]}`\n * form.\n *\n * Eg:\n * - `\"src/*\"` => `{packages:[\"src/*\"]}`\n * - `{\"apps\": \"src/*\"}` => `{apps: [\"src/*\"]}`\n */\n get config(): WorkspaceConfigObject {\n if (this.#config) return this.#config\n const file = resolve(this.projectRoot, 'vlt-workspaces.json')\n let confData: string\n try {\n confData = readFileSync(file, 'utf8')\n } catch (er) {\n throw error('Not in a monorepo, no vlt-workspaces.json found', {\n path: this.projectRoot,\n cause: er,\n })\n }\n let parsed: unknown\n try {\n parsed = parse(confData)\n } catch (er) {\n throw error('Invalid vlt-workspaces.json file', {\n path: this.projectRoot,\n cause: er,\n })\n }\n this.#config = asWSConfig(parsed, file)\n return this.#config\n }\n\n /**\n * Iterating the Monorepo object yields the workspace objects, in as close to\n * topological dependency order as possible.\n */\n *[Symbol.iterator](): Generator<Workspace, void, void> {\n const [ws] = [...this.values()]\n if (!ws) return\n // leverage the fact that graphRun returns results in\n // as close to topological order as possible.\n for (const workspace of this.runSync(() => {}).keys()) {\n yield workspace\n }\n }\n\n /**\n * Iterating the Monorepo object yields the workspace objects, in as close to\n * topological dependency order as possible.\n */\n async *[Symbol.asyncIterator](): AsyncGenerator<\n Workspace,\n void,\n void\n > {\n const [ws] = [...this.values()]\n if (!ws) return\n for (const workspace of (await this.run(() => {})).keys()) {\n yield workspace\n }\n }\n\n /**\n * By default, loads all workspaces reachable in the Monorepo.\n *\n * If provided with one (`string`)or more (`string[]`) group names in\n * the {@link LoadQuery#groups} field, then only Workspaces in the named\n * group(s) will be considered. Note that group names are unique string\n * matches, not globs.\n *\n * If provided with a set of arbitrary path arguments, then only paths\n * patching the provided pattern(s) will be included.\n *\n * These two options intersect, so\n * `load({groups:'foo', paths:'./foo/[xy]*'})` will only load the workspaces\n * in the group `foo` that match the paths glob.\n */\n load(query: LoadQuery = {}): this {\n const paths = new Set(\n typeof query.paths === 'string' ?\n [query.paths]\n : (query.paths ?? []),\n )\n const groups = new Set(\n typeof query.groups === 'string' ?\n [query.groups]\n : (query.groups ?? []),\n )\n\n const groupsExpanded: Record<string, Set<string>> = {}\n for (const [group, pattern] of Object.entries(this.config)) {\n if (groups.size && !groups.has(group)) continue\n groupsExpanded[group] = this.#glob(pattern)\n }\n const filter = paths.size ? this.#glob([...paths]) : paths\n\n // if we specified paths, but none matched, nothing to do\n if (paths.size && !filter.size) return this\n\n for (const [group, matches] of Object.entries(groupsExpanded)) {\n for (const path of matches) {\n if (filter.size && !filter.has(path)) continue\n this.#loadWS(path, group)\n }\n }\n\n return this\n }\n\n // Either load a workspace from disk, or from our internal set,\n // and assign it to the named group\n #loadWS(path: string, group?: string): Workspace {\n const fullpath = resolve(this.projectRoot, path)\n const loaded = this.#workspaces.get(fullpath)\n if (loaded) return loaded\n const fromCache = workspaceCache.get(fullpath)\n const manifest =\n fromCache?.manifest ?? this.packageJson.read(fullpath)\n const ws = fromCache ?? new Workspace(path, manifest, fullpath)\n if (group) ws.groups.push(group)\n this.#workspaces.set(ws.fullpath, ws)\n this.#workspaces.set(ws.path, ws)\n this.#workspaces.set(ws.name, ws)\n for (const name of ws.groups) {\n const group = this.#groups.get(name) ?? new Set()\n group.add(ws)\n this.#groups.set(name, group)\n }\n return ws\n }\n\n // can't be cached, because it's dependent on the matches set\n // but still worthwhile to have it defined in one place\n #globOptions(matches: Set<string>): GlobOptionsWithFileTypesFalse {\n // if the entry or any of its parent dirs are already matched,\n // then we should not explore further down that directory tree.\n // if we hit the projectRoot then stop searching.\n const inMatches = (p?: Path): boolean => {\n return (\n !!p?.relativePosix() &&\n (matches.has(p.relativePosix()) || inMatches(p.parent))\n )\n }\n\n return {\n root: this.projectRoot,\n cwd: this.projectRoot,\n posix: true,\n scurry: this.scurry,\n withFileTypes: false,\n ignore: {\n childrenIgnored: p =>\n basename(p.relativePosix()) === 'node_modules' ||\n inMatches(p),\n // ignore if fails to load package.json\n ignored: p => {\n p.lstatSync()\n const rel = p.relativePosix()\n if (!rel) return true\n const maybeDelete: string[] = []\n for (const m of matches) {\n if (rel.startsWith(m + '/')) return true\n if (m.startsWith(rel + '/')) {\n maybeDelete.push(m)\n }\n }\n if (!p.isDirectory()) return true\n const pj = p.resolve('package.json').lstatSync()\n if (!pj?.isFile()) return true\n try {\n this.packageJson.read(p.fullpath())\n } catch {\n return true\n }\n for (const m of maybeDelete) {\n matches.delete(m)\n }\n matches.add(rel)\n return false\n },\n },\n }\n }\n\n #glob(pattern: string[] | string) {\n const matches = new Set<string>()\n globSync(pattern, this.#globOptions(matches))\n return matches\n }\n\n /**\n * Return the array of workspace dependencies that are found in\n * the loaded set, for use in calculating dependency graph order for\n * build operations.\n *\n * This does *not* get the full set of dependencies, or expand any\n * `workspace:` dependencies that are not loaded.\n *\n * Call with the `forceLoad` param set to `true` to attempt a full\n * load if any deps are not currently loaded.\n */\n getDeps(ws: Workspace, forceLoad = false): Workspace[] {\n // load manifest and find workspace: deps\n // filter by those loaded\n const { manifest } = ws\n const depWorkspaces: Workspace[] = []\n let didForceLoad = false\n for (const depType of [\n 'dependencies',\n 'devDependencies',\n 'optionalDependencies',\n 'peerDependencies',\n ] as const) {\n const deps = manifest[depType]\n if (!deps) continue\n for (const [dep, spec] of Object.entries(deps)) {\n if (spec.startsWith('workspace:')) {\n let depWS = this.#workspaces.get(dep)\n if (!depWS) {\n if (!forceLoad) continue\n if (didForceLoad) continue\n didForceLoad = true\n this.load()\n depWS = this.#workspaces.get(dep)\n if (!depWS) continue\n }\n depWorkspaces.push(depWS)\n }\n }\n }\n return depWorkspaces\n }\n\n onCycle(\n _ws: Workspace,\n _cycle: Workspace[],\n _depPath: Workspace[],\n ) {\n // XXX - process logging? Need to say something like:\n // Cyclical workspace dependency warning!\n // When evaluating dependency ${ws.name} via ${\n // path.map(ws => ws.name).join(' -> ')\n // }, a dependency cycle was detected: ${\n // cycle.map(ws => ws.name).join(' -> ')\n // }. Operation will continue, but dependency order not guaranteed.`\n }\n\n /**\n * Return the set of workspaces in the named group.\n * If the group is not one we know about, then undefined is returned.\n */\n group(group: string) {\n return this.#groups.get(group)\n }\n\n /**\n * Get a loaded workspace by path or name.\n *\n * Note that this can only return workspaces that were ingested via a\n * previous call to {@link Monorepo#load}.\n */\n get(nameOrPath: string) {\n return this.#workspaces.get(nameOrPath)\n }\n\n /**\n * get the list of all loaded workspace names used as keys\n */\n *names() {\n for (const [key, ws] of this.#workspaces) {\n if (key === ws.name) yield key\n }\n }\n\n /**\n * get the list of all loaded workspace paths used as keys\n */\n *paths() {\n for (const [key, ws] of this.#workspaces) {\n if (key === ws.path) yield key\n }\n }\n\n /**\n * get the workspace objects in no particular order.\n * this is ever so slightly faster than iterating, because it doesn't\n * explore the graph to yield results in topological dependency order,\n * and should be used instead when order doesn't matter.\n */\n *values() {\n const seen = new Set<string>()\n for (const ws of this.#workspaces.values()) {\n if (seen.has(ws.fullpath)) continue\n seen.add(ws.fullpath)\n yield ws\n }\n }\n\n /**\n * Get all the keys (package names and paths) for loaded workspaces.\n * Union of {@link Monorepo#names} and {@link Monorepo#paths}\n */\n *keys() {\n for (const ws of this.values()) {\n yield ws.path\n if (ws.name !== ws.path) yield ws.name\n }\n }\n\n /**\n * Filter the monorepo object yielding the workspace objects that matches\n * either of the {@link WorkspacesLoadedConfig} options provided, in as close\n * to topological dependency order as possible.\n */\n *filter({\n workspace: namesOrPaths,\n 'workspace-group': groupName,\n }: WorkspacesLoadedConfig) {\n const globPatternChecks = namesOrPaths?.map(glob =>\n minimatch.filter(posix.join(glob)),\n )\n for (const ws of this) {\n // check if any group has any of the provided group names\n if (groupName?.some(i => ws.groups.includes(i))) {\n yield ws\n continue\n }\n // check if any workspace-provided name directly matches any of the\n // configured workspaces by either name or file path\n if (\n namesOrPaths\n ?.map(i => posix.join(i))\n .some(i => ws.keys.includes(i))\n ) {\n yield ws\n continue\n }\n // check if one of the workspace values are matching glob patterns\n if (\n ws.keys.some(key => globPatternChecks?.some(fn => fn(key)))\n ) {\n yield ws\n }\n }\n }\n\n /**\n * Run an operation asynchronously over all loaded workspaces\n *\n * If the `forceLoad` param is true, then it will attempt to do a full load\n * when encountering a `workspace:` dependency that isn't loaded.\n *\n * Note that because the return type appears in the parameters of the\n * operation function, it must be set explicitly either in the operation\n * function signature or by calling `run<MyType>` or it'll fall back to\n * `unknown`, similar to `Array.reduce()`, and for the same reason.\n */\n async run<R>(\n operation: (\n s: Workspace,\n signal: AbortSignal,\n depResults: DepResults<Workspace, R>,\n ) => Promise<R> | R,\n forceLoad = false,\n ) {\n const [ws, ...rest] = [...this.#workspaces.values()]\n if (!ws) {\n throw error('No workspaces loaded', undefined, this.run)\n }\n\n return graphRun<Workspace, R>({\n graph: [ws, ...rest],\n getDeps: ws => this.getDeps(ws, forceLoad),\n visit: async (ws, signal, _, depResults) =>\n await operation(ws, signal, depResults),\n onCycle: (ws, cycle, path) => this.onCycle(ws, cycle, path),\n })\n }\n\n /**\n * Run an operation synchronously over all loaded workspaces\n *\n * If the `forceLoad` param is true, then it will attempt to do a full load\n * when encountering a `workspace:` dependency that isn't loaded.\n *\n * Note that because the return type appears in the parameters of the\n * operation function, it must be set explicitly either in the operation\n * function signature or by calling `runSync<MyType>` or it'll fall back to\n * `unknown`, similar to `Array.reduce()`, and for the same reason.\n */\n runSync<R>(\n operation: (\n s: Workspace,\n signal: AbortSignal,\n depResults: DepResults<Workspace, R>,\n ) => R,\n forceLoad = false,\n ) {\n const [ws, ...rest] = [...this.#workspaces.values()]\n if (!ws) {\n throw error('No workspaces loaded', undefined, this.run)\n }\n\n return graphRunSync<Workspace, R>({\n graph: [ws, ...rest],\n getDeps: ws => this.getDeps(ws, forceLoad),\n visit: (ws, signal, _, depResults) =>\n operation(ws, signal, depResults),\n onCycle: (ws, cycle, path) => this.onCycle(ws, cycle, path),\n })\n }\n\n /**\n * Convenience method to instantiate and load in one call.\n * Returns undefined if the project is not a monorepo workspaces\n * root, otherwise returns the loaded Monorepo.\n */\n static maybeLoad(\n projectRoot: string,\n options: MonorepoOptions = { load: {} },\n ) {\n try {\n if (\n !statSync(\n resolve(projectRoot, 'vlt-workspaces.json'),\n ).isFile()\n ) {\n return\n }\n } catch {\n return\n }\n const { load = {} } = options\n return new Monorepo(projectRoot, { ...options, load })\n }\n\n /**\n * Convenience method to instantiate and load in one call.\n * Throws if called on a directory that is not a workspaces root.\n */\n static load(\n projectRoot: string,\n options: MonorepoOptions = { load: {} },\n ) {\n const { load = {} } = options\n return new Monorepo(projectRoot, { ...options, load })\n }\n}\n\nexport const workspaceCache = new Map<string, Workspace>()\n\n/**\n * Class representing a single Workspace in a {@link Monorepo}\n */\nexport class Workspace {\n id: DepID\n path: string\n fullpath: string\n manifest: Manifest\n groups: string[] = []\n name: string\n #keys?: string[]\n\n constructor(path: string, manifest: Manifest, fullpath: string) {\n this.id = joinDepIDTuple(['workspace', path])\n workspaceCache.set(fullpath, this)\n this.path = path\n this.fullpath = fullpath\n this.manifest = manifest\n this.name = manifest.name ?? path\n }\n\n get keys(): string[] {\n if (this.#keys) {\n return this.#keys\n }\n this.#keys = [this.name, this.path, this.fullpath]\n return this.#keys\n }\n}\n", "import { setMaxListeners } from 'node:events'\n\n/**\n * Options that define the graph and how to traverse it\n */\nexport interface RunnerOptions<Node, Result = void> {\n /** Array of one or more entry nodes. */\n graph: [node: Node, ...rest: Node[]]\n\n /** get the dependencies of a given node */\n getDeps: (node: Node) => Node[] | Promise<Node[]>\n\n /** action to take on each node */\n visit: (\n node: Node,\n signal: AbortSignal,\n path: Node[],\n depResults: DepResults<Node, Result>,\n ) => Result | Promise<Result>\n\n /**\n * Called when a cycle is encountered.\n * Throw in this method to enforce a DAG graph.\n * If left undefined, then cycles are silently ignored and skipped.\n *\n * `node` parameter is the dependency that is being skipped.\n *\n * `cycle` is the route from the dependent back to itself via\n * the parent.\n *\n * `path` is the path to the dependent who wanted this dep to be\n * loaded.\n */\n onCycle?: (\n node: Node,\n cycle: Node[],\n path: Node[],\n ) => void | Promise<void>\n\n /**\n * Set to `false` to continue operations even if errors occur.\n * If set to false, then an AggregateError will be raised on failure\n * containing all failures (even if only one). If true, then a normal\n * Error will be raised on failure.\n *\n * @default true\n */\n failFast?: boolean\n\n /** a signal that will trigger the graph traversal to end prematurely */\n signal?: AbortSignal\n}\n\nexport type DepResults<Node, Result> = Map<Node, Result | undefined>\n\n/**\n * Options that can define a synchronous graph traversal.\n *\n * Note that if the visit() method is async, then the *promises themselves*\n * will be used as the `Result` type, which is likely not what you want!\n */\nexport interface RunnerOptionsSync<Node, Result = void>\n extends RunnerOptions<Node, Result> {\n /** Get a set of dependency nodes synchronously */\n getDeps: (node: Node) => Node[]\n\n /** Visit a node synchronously */\n visit: (\n node: Node,\n signal: AbortSignal,\n path: Node[],\n depResults: DepResults<Node, Result>,\n ) => Result\n\n /** Handle cycles synchronously */\n onCycle?: (node: Node, cycle: Node[], path: Node[]) => void\n}\n\n/** A map of nodes to their PromiseSettledResult value */\nexport type SettledMap<Node, Result = void> = Map<\n Node,\n PromiseSettledResult<Result>\n>\n\n/** Any function or class. Used for Error.captureStackTrace */\nexport type Callable =\n | Function\n | ((...a: unknown[]) => unknown)\n | {\n new (...a: unknown[]): unknown\n }\n\n/** Base class of Runner and RunnerSync */\nexport abstract class RunnerBase<\n /** The type of thing to be found in this graph */\n Node,\n /** Type returned by the visit() method */\n Result = void,\n Sync extends boolean = false,\n O extends Sync extends true ? RunnerOptionsSync<Node, Result>\n : RunnerOptions<Node, Result> = Sync extends true ?\n RunnerOptionsSync<Node, Result>\n : RunnerOptions<Node, Result>,\n> {\n /** The map of traversal results */\n readonly results: Map<Node, Result> = new Map()\n\n /** The map of PromiseSettledResult objects */\n readonly settled: SettledMap<Node, Result> = new Map()\n\n /** Set of dependents (direct & transitive) on each node */\n readonly dependents: Map<Node, Set<Node>> = new Map()\n\n /** Set of direct dependents on each node */\n readonly directDependents: Map<Node, Set<Node>> = new Map()\n\n /** Options provided to constructor */\n readonly options: O\n\n /**\n * AbortController used internally to abort the process.\n *\n * This is internal only, and triggering it at the wrong time may cause\n * undefined and unsupported behavior. Do not use!\n *\n * Instead, if you want to be able to abort the walk at any time, provide\n * your own AbortSignal in the opions.\n *\n * @internal\n */\n readonly abortController: AbortController\n\n /** True if we are in failFast mode */\n readonly failFast: boolean\n\n /** Rejections and Errors encountered in the traversal */\n readonly errors: unknown[] = []\n\n /**\n * Function defining the callsite where the traversal was initiated,\n * used for Error.captureStackTrace.\n */\n readonly from: Callable\n\n constructor(options: O, from?: Callable) {\n const ac = new AbortController()\n this.from = from ?? this.constructor\n this.abortController = ac\n setMaxListeners(Infinity, ac.signal)\n this.options = options\n if (!options.graph.length) {\n const er = new Error('no nodes provided to graph traversal', {\n cause: {\n found: options.graph,\n wanted: '[first: Node, ...rest: Node[]]',\n },\n })\n Error.captureStackTrace(er, from)\n throw er\n }\n this.failFast = options.failFast !== false\n const { signal } = options\n if (signal !== undefined) {\n signal.addEventListener('abort', reason => ac.abort(reason), {\n once: true,\n signal: ac.signal,\n })\n }\n }\n\n /** Initiate the graph traversal, resolving/returning when complete */\n abstract run(): Sync extends true ? void : Promise<void>\n\n /** Get the dependencies of a given node */\n abstract getDeps(\n n: Node,\n ): Sync extends true ? Node[] : Promise<Node[]>\n\n /** Visit a node. Calls `options.visit()` */\n abstract visit(\n n: Node,\n path: Node[],\n depResults: DepResults<Node, Result>,\n ): Sync extends true ? Result : Promise<Result>\n\n /**\n * Calls the `options.onCycle()` method when a cycle is detected.\n */\n abstract onCycle(\n n: Node,\n cycle: Node[],\n path: Node[],\n ): Sync extends true ? void : void | Promise<void>\n\n /**\n * For a Node `n` that depends directly or transitively on Node `d`, find the\n * shortest known dependency path from `n` to `d`. This is done by walking\n * backwards breadth-first up the dependency relations from `d` until `n` is\n * found.\n *\n * If no known path can be found, then `undefined` is returned. Otherwise,\n * a path array is returned that starts with `n` and ends with `d`.\n *\n * Note that self-referential links are never considered, since they're\n * by definition cyclical.\n */\n route(n: Node, d: Node): undefined | [n: Node, ...path: Node[]] {\n const dependents = this.dependents.get(d)\n if (!dependents?.has(n)) return undefined\n const directDependents = this.directDependents.get(d)\n /* c8 ignore next */\n if (!directDependents) return undefined\n if (directDependents.has(n)) {\n return [n, d]\n }\n const queue: [n: Node, ...r: Node[]][] = [\n ...directDependents,\n ].map(dd => [dd, d])\n let step: undefined | [n: Node, ...r: Node[]] = undefined\n while (undefined !== (step = queue.shift())) {\n /* c8 ignore next */\n if (!dependents.has(step[0])) continue\n if (step[0] === n) {\n return step\n }\n const ddd = this.directDependents.get(step[0])\n if (ddd) {\n for (const d of ddd) {\n queue.push([d, ...step])\n }\n }\n }\n }\n\n /**\n * If the dependency from `n -> d` at the specified path would\n * cause a cycle, then call the onCycle method and return true.\n * Oherwise, assign the appropriate entries in the dependency\n * tracking sets, and return false.\n *\n * @internal\n */\n cycleCheck(n: Node, path: Node[], d: Node) {\n /* c8 ignore next */\n const dependents = this.dependents.get(n) ?? new Set()\n this.dependents.set(n, dependents)\n const isCycle = dependents.has(d)\n if (isCycle) {\n const cycle = this.route(d, n)\n /* c8 ignore start - impossible */\n if (!cycle) {\n throw new Error('cycle detected, but cycle route not found')\n }\n /* c8 ignore stop */\n cycle.unshift(n)\n this.onCycle(d, cycle, path)\n return true\n }\n\n const depDD = this.directDependents.get(d) ?? new Set()\n this.directDependents.set(d, depDD)\n depDD.add(n)\n\n const depDependents = this.dependents.get(d) ?? new Set()\n this.dependents.set(d, depDependents)\n for (const n of dependents) {\n depDependents.add(n)\n }\n depDependents.add(n)\n return false\n }\n\n /**\n * Method that handles errors raised by visits.\n *\n * @internal\n */\n handleError(er: unknown, n: Node, path: Node[]) {\n this.errors.push(er)\n this.settled.set(n, {\n status: 'rejected',\n reason: er,\n })\n if (this.failFast) {\n this.abortController.abort(er)\n const e = new Error('failed graph traversal', {\n cause: {\n node: n,\n path,\n cause: er as Error,\n },\n })\n Error.captureStackTrace(e, this.from)\n throw e\n }\n }\n\n /**\n * Method that handles successful visit results\n *\n * @internal\n */\n handleValue(value: Result, n: Node) {\n this.results.set(n, value)\n this.settled.set(n, {\n status: 'fulfilled',\n value,\n })\n }\n}\n\n/** Asynchronous graph runner */\nexport class Runner<Node, Result> extends RunnerBase<\n Node,\n Result,\n false,\n RunnerOptions<Node, Result>\n> {\n /** Map of nodes currently awaiting completion */\n readonly running = new Map<Node, Promise<void>>()\n\n async getDeps(n: Node) {\n /* c8 ignore next */\n if (this.abortController.signal.aborted) return []\n const deps = await this.options.getDeps(n);\n for (const d of deps) {\n const dependents = this.dependents.get(d) ?? new Set()\n this.dependents.set(d, dependents)\n dependents.add(n)\n const depDD = this.directDependents.get(d) ?? new Set()\n this.directDependents.set(d, depDD)\n depDD.add(n)\n }\n return deps\n }\n\n async visit(\n n: Node,\n path: Node[],\n depResults: DepResults<Node, Result>,\n ) {\n const { signal } = this.abortController\n return this.options.visit(n, signal, path, depResults)\n }\n\n async onCycle(n: Node, cycle: Node[], path: Node[]) {\n /* c8 ignore next */\n if (this.abortController.signal.aborted) return\n await this.options.onCycle?.(n, cycle, path)\n }\n\n async #walk(n: Node, path: Node[]) {\n const r = this.running.get(n)\n /* c8 ignore next */\n if (r) return r\n /* c8 ignore start */\n if (this.settled.get(n)) return\n /* c8 ignore stop */\n const p = this.#step(n, path).then(\n () => {\n this.running.delete(n)\n },\n /* c8 ignore start - handled deeper in the chain */\n er => {\n this.running.delete(n)\n throw er\n },\n /* c8 ignore stop */\n )\n this.running.set(n, p)\n return p\n }\n\n async #step(n: Node, path: Node[]) {\n const dependents = this.dependents.get(n) ?? new Set()\n this.dependents.set(n, dependents)\n\n const deps = await this.getDeps(n)\n const awaiting: Promise<void>[] = []\n const depPath = [...path, n]\n\n for (const d of deps) {\n /* c8 ignore next */\n if (this.abortController.signal.aborted) return\n // self-link, skip\n if (d === n) continue\n if (this.cycleCheck(n, depPath, d)) continue\n /* c8 ignore next */\n if (this.settled.get(d)) continue\n awaiting.push(this.running.get(d) ?? this.#walk(d, depPath))\n }\n\n /* c8 ignore next */\n if (this.abortController.signal.aborted) return\n await Promise.all(awaiting)\n if (this.abortController.signal.aborted) return\n const depRes = new Map<Node, Result | undefined>(\n deps.map(d => [d, this.results.get(d)]),\n )\n try {\n this.handleValue(await this.visit(n, path, depRes), n)\n } catch (er) {\n this.handleError(er, n, path)\n }\n }\n\n async run(): Promise<void> {\n const promises: Promise<void>[] = []\n for (const n of this.options.graph) {\n promises.push(this.#walk(n, []))\n }\n await Promise.all(promises)\n }\n}\n\n/** Synchronous graph runner */\nexport class RunnerSync<Node, Result> extends RunnerBase<\n Node,\n Result,\n true,\n RunnerOptionsSync<Node, Result>\n> {\n getDeps(n: Node) {\n if (this.abortController.signal.aborted) return []\n return this.options.getDeps(n)\n }\n\n visit(n: Node, path: Node[], depResults: DepResults<Node, Result>) {\n const { signal } = this.abortController\n return this.options.visit(n, signal, path, depResults)\n }\n\n onCycle(n: Node, cycle: Node[], path: Node[]) {\n /* c8 ignore next */\n if (this.abortController.signal.aborted) return\n this.options.onCycle?.(n, cycle, path)\n }\n\n #walk(n: Node, path: Node[]) {\n /* c8 ignore start */\n if (this.settled.get(n)) return\n /* c8 ignore stop */\n this.#step(n, path)\n }\n\n #step(n: Node, path: Node[]) {\n const dependents = this.dependents.get(n) ?? new Set()\n this.dependents.set(n, dependents)\n\n const deps = this.getDeps(n)\n const depPath = [...path, n]\n for (const d of deps) {\n if (this.abortController.signal.aborted) return\n /* c8 ignore next */\n if (d === n) continue\n if (this.cycleCheck(n, depPath, d)) continue\n if (!this.settled.get(d)) this.#walk(d, depPath)\n }\n\n if (this.abortController.signal.aborted) return\n const depRes = new Map<Node, Result | undefined>(\n deps.map(d => [d, this.results.get(d)]),\n )\n try {\n this.handleValue(this.visit(n, path, depRes), n)\n } catch (er) {\n this.handleError(er, n, path)\n }\n }\n\n run(): Map<Node, Result> {\n for (const n of this.options.graph) {\n this.#walk(n, [])\n }\n return this.results\n }\n}\n\n/**\n * Asynchronous graph traversal method\n *\n * If `failFast:false` is set in the options, then an AggregateError\n * will be raised if there were any failures. Otherwise, a normal Error\n * is raised on failure.\n */\nexport const graphRun = async <Node, Result>(\n options: RunnerOptions<Node, Result>,\n): Promise<Map<Node, Result>> => {\n const runner = new Runner(options, graphRun)\n await runner.run()\n if (runner.errors.length) {\n const e = new AggregateError(\n runner.errors,\n 'failed graph traversal',\n )\n Error.captureStackTrace(e, graphRun)\n throw e\n }\n return runner.results\n}\n\n/**\n * Synchronous graph traversal method\n *\n * If `failFast:false` is set in the options, then an AggregateError\n * will be thrown if there were any failures. Otherwise, a normal Error\n * is thrown on failure.\n */\nexport const graphRunSync = <Node, Result>(\n options: RunnerOptionsSync<Node, Result>,\n): Map<Node, Result> => {\n const runner = new RunnerSync(options, graphRunSync)\n runner.run()\n if (runner.errors.length) {\n const e = new AggregateError(\n runner.errors,\n 'failed graph traversal',\n )\n Error.captureStackTrace(e, graphRunSync)\n throw e\n }\n return runner.results\n}\n\n/**\n * Asynchronous graph traversal, capturing all error/result\n * statuses.\n */\nexport const allSettled = async <Node, Result>(\n options: RunnerOptions<Node, Result>,\n): Promise<SettledMap<Node, Result>> => {\n const runner = new Runner(\n { ...options, failFast: false },\n allSettled,\n )\n await runner.run()\n return runner.settled\n}\n\n/**\n * Synchronous graph traversal, capturing all error/result\n * statuses.\n */\nexport const allSettledSync = <Node, Result>(\n options: RunnerOptionsSync<Node, Result>,\n): SettledMap<Node, Result> => {\n const runner = new RunnerSync(\n { ...options, failFast: false },\n allSettledSync,\n )\n runner.run()\n return runner.settled\n}\n\n/**\n * Asynchronous graph traversal, returning the first successful visit.\n * If all visits fail, then an AggregateError is raised with all errors\n * encountered.\n */\nexport const any = async <Node, Result>(\n options: RunnerOptions<Node, Result>,\n): Promise<Result> => {\n const ac = new AbortController()\n let result!: Result\n let found: boolean = false\n const runner = new Runner<Node, Result>(\n {\n ...options,\n failFast: false,\n signal: ac.signal,\n visit: async (node, signal, path, depResults) => {\n try {\n result = await options.visit(node, signal, path, depResults)\n found = true\n ac.abort('found')\n } finally {\n return result\n }\n },\n },\n any,\n )\n await runner.run()\n if (!found) {\n const e = new AggregateError(\n runner.errors,\n 'failed graph traversal',\n )\n Error.captureStackTrace(e, any)\n throw e\n }\n return result\n}\n\n/**\n * Synchronous graph traversal, returning the first successful visit.\n * If all visits fail, then an AggregateError is thrown with all errors\n * encountered.\n */\nexport const anySync = <Node, Result>(\n options: RunnerOptionsSync<Node, Result>,\n): Result => {\n const ac = new AbortController()\n let result!: Result\n let found: boolean = false\n const runner = new RunnerSync<Node, Result>(\n {\n ...options,\n failFast: false,\n signal: ac.signal,\n visit: (node, signal, path, depResults) => {\n try {\n result = options.visit(node, signal, path, depResults)\n found = true\n ac.abort('found')\n } finally {\n return result\n }\n },\n },\n anySync,\n )\n runner.run()\n if (!found) {\n const e = new AggregateError(\n runner.errors,\n 'failed graph traversal',\n )\n Error.captureStackTrace(e, anySync)\n throw e\n }\n return result\n}\n\n/**\n * Asynchronous graph traversal, resolving or rejecting when the first visit\n * resolves or rejects.\n */\nexport const race = async <Node, Result>(\n options: RunnerOptions<Node, Result>,\n): Promise<Result> => {\n const ac = new AbortController()\n let result!: Result\n const runner = new Runner<Node, Result>(\n {\n ...options,\n failFast: true,\n signal: ac.signal,\n visit: async (node, signal, path, depResults) => {\n try {\n result = await options.visit(node, signal, path, depResults)\n ac.abort('found')\n } finally {\n return result\n }\n },\n },\n race,\n )\n await runner.run()\n return result\n}\n\n/**\n * Synchronous graph traversal, returning or throwing when the first visit\n * is completed.\n */\nexport const raceSync = <Node, Result>(\n options: RunnerOptionsSync<Node, Result>,\n): Result => {\n const ac = new AbortController()\n let result!: Result\n const runner = new RunnerSync<Node, Result>(\n {\n ...options,\n failFast: true,\n signal: ac.signal,\n visit: (node, signal, path, depResults) => {\n try {\n result = options.visit(node, signal, path, depResults)\n ac.abort('found')\n } finally {\n return result\n }\n },\n },\n race,\n )\n runner.run()\n return result\n}\n", "import { dirname, resolve } from 'path'\nexport const walkUp = function* (path: string) {\n for (path = resolve(path); path;) {\n yield path\n const pp = dirname(path)\n if (pp === path) {\n break\n } else {\n path = pp\n }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAKO,IAAM,YAAuB;AAsDpC,IAAM,cAAc,IAAI;AAAA,EACtB,WAAW,SAAS,KAAK,SAAS,KAAK,SAAS,KAAK,SAAS,MAC5D,SACF,KAAK,SAAS,iCAEe,SAAS,KAClC,SACF,OAAO,SAAS,KAAK,SAAS;AAClC;AAEO,IAAM,UAAU,CAAC,QACtB,OAAO,QAAQ,YAAY,YAAY,KAAK,GAAG;AAE1C,IAAM,UAAU,CAAC,QAAuB;AAC7C,MAAI,CAAC,QAAQ,GAAG,GAAG;AACjB,UAAM,MAAM,mBAAmB;AAAA,MAC7B,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AACA,SAAO;AACT;AAKO,IAAM,iBAAiB,CAAC,SAA4B;AACzD,QAAM,CAAC,MAAM,OAAO,QAAQ,KAAK,IAAI;AACrC,QAAM,IAAI,OAAO,KAAK;AACtB,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,GAAG,OAAO,MAAM,CAAC,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,KAAK,CAAC,KAAK,EAAE;AAAA,IACpG,KAAK;AACH,aAAO,GAAG,IAAI,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,GAAG,OAAO,MAAM,CAAC,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,KAAK,CAAC,KAAK,EAAE;AAAA,IAC3G;AACE,aAAO,GAAG,IAAI,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,MAAM,CAAC,KAAK,EA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AAQ,IAAI;AACvB,QAAI,OAAO,MAAM;AACf;IACF,OAAO;AACL,aAAO;IACT;EACF;AACF;",
6
- "names": ["s", "d", "n", "group", "ws", "resolve"]
7
- }
package/chunk-JQRUGUZ3.js DELETED
@@ -1,512 +0,0 @@
1
- var global = globalThis;
2
- import {Buffer} from "node:buffer";
3
- import {setImmediate, clearImmediate} from "node:timers";
4
- import {createRequire as _vlt_createRequire} from 'node:module';
5
- var require = _vlt_createRequire(import.meta.filename);
6
-
7
- // ../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
8
- var ANSI_BACKGROUND_OFFSET = 10;
9
- var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
10
- var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
11
- var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
12
- var styles = {
13
- modifier: {
14
- reset: [0, 0],
15
- // 21 isn't widely supported and 22 does the same thing
16
- bold: [1, 22],
17
- dim: [2, 22],
18
- italic: [3, 23],
19
- underline: [4, 24],
20
- overline: [53, 55],
21
- inverse: [7, 27],
22
- hidden: [8, 28],
23
- strikethrough: [9, 29]
24
- },
25
- color: {
26
- black: [30, 39],
27
- red: [31, 39],
28
- green: [32, 39],
29
- yellow: [33, 39],
30
- blue: [34, 39],
31
- magenta: [35, 39],
32
- cyan: [36, 39],
33
- white: [37, 39],
34
- // Bright color
35
- blackBright: [90, 39],
36
- gray: [90, 39],
37
- // Alias of `blackBright`
38
- grey: [90, 39],
39
- // Alias of `blackBright`
40
- redBright: [91, 39],
41
- greenBright: [92, 39],
42
- yellowBright: [93, 39],
43
- blueBright: [94, 39],
44
- magentaBright: [95, 39],
45
- cyanBright: [96, 39],
46
- whiteBright: [97, 39]
47
- },
48
- bgColor: {
49
- bgBlack: [40, 49],
50
- bgRed: [41, 49],
51
- bgGreen: [42, 49],
52
- bgYellow: [43, 49],
53
- bgBlue: [44, 49],
54
- bgMagenta: [45, 49],
55
- bgCyan: [46, 49],
56
- bgWhite: [47, 49],
57
- // Bright color
58
- bgBlackBright: [100, 49],
59
- bgGray: [100, 49],
60
- // Alias of `bgBlackBright`
61
- bgGrey: [100, 49],
62
- // Alias of `bgBlackBright`
63
- bgRedBright: [101, 49],
64
- bgGreenBright: [102, 49],
65
- bgYellowBright: [103, 49],
66
- bgBlueBright: [104, 49],
67
- bgMagentaBright: [105, 49],
68
- bgCyanBright: [106, 49],
69
- bgWhiteBright: [107, 49]
70
- }
71
- };
72
- var modifierNames = Object.keys(styles.modifier);
73
- var foregroundColorNames = Object.keys(styles.color);
74
- var backgroundColorNames = Object.keys(styles.bgColor);
75
- var colorNames = [...foregroundColorNames, ...backgroundColorNames];
76
- function assembleStyles() {
77
- const codes = /* @__PURE__ */ new Map();
78
- for (const [groupName, group] of Object.entries(styles)) {
79
- for (const [styleName, style] of Object.entries(group)) {
80
- styles[styleName] = {
81
- open: `\x1B[${style[0]}m`,
82
- close: `\x1B[${style[1]}m`
83
- };
84
- group[styleName] = styles[styleName];
85
- codes.set(style[0], style[1]);
86
- }
87
- Object.defineProperty(styles, groupName, {
88
- value: group,
89
- enumerable: false
90
- });
91
- }
92
- Object.defineProperty(styles, "codes", {
93
- value: codes,
94
- enumerable: false
95
- });
96
- styles.color.close = "\x1B[39m";
97
- styles.bgColor.close = "\x1B[49m";
98
- styles.color.ansi = wrapAnsi16();
99
- styles.color.ansi256 = wrapAnsi256();
100
- styles.color.ansi16m = wrapAnsi16m();
101
- styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
102
- styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
103
- styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
104
- Object.defineProperties(styles, {
105
- rgbToAnsi256: {
106
- value(red, green, blue) {
107
- if (red === green && green === blue) {
108
- if (red < 8) {
109
- return 16;
110
- }
111
- if (red > 248) {
112
- return 231;
113
- }
114
- return Math.round((red - 8) / 247 * 24) + 232;
115
- }
116
- return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
117
- },
118
- enumerable: false
119
- },
120
- hexToRgb: {
121
- value(hex) {
122
- const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
123
- if (!matches) {
124
- return [0, 0, 0];
125
- }
126
- let [colorString] = matches;
127
- if (colorString.length === 3) {
128
- colorString = [...colorString].map((character) => character + character).join("");
129
- }
130
- const integer = Number.parseInt(colorString, 16);
131
- return [
132
- /* eslint-disable no-bitwise */
133
- integer >> 16 & 255,
134
- integer >> 8 & 255,
135
- integer & 255
136
- /* eslint-enable no-bitwise */
137
- ];
138
- },
139
- enumerable: false
140
- },
141
- hexToAnsi256: {
142
- value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
143
- enumerable: false
144
- },
145
- ansi256ToAnsi: {
146
- value(code) {
147
- if (code < 8) {
148
- return 30 + code;
149
- }
150
- if (code < 16) {
151
- return 90 + (code - 8);
152
- }
153
- let red;
154
- let green;
155
- let blue;
156
- if (code >= 232) {
157
- red = ((code - 232) * 10 + 8) / 255;
158
- green = red;
159
- blue = red;
160
- } else {
161
- code -= 16;
162
- const remainder = code % 36;
163
- red = Math.floor(code / 36) / 5;
164
- green = Math.floor(remainder / 6) / 5;
165
- blue = remainder % 6 / 5;
166
- }
167
- const value = Math.max(red, green, blue) * 2;
168
- if (value === 0) {
169
- return 30;
170
- }
171
- let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
172
- if (value === 2) {
173
- result += 60;
174
- }
175
- return result;
176
- },
177
- enumerable: false
178
- },
179
- rgbToAnsi: {
180
- value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
181
- enumerable: false
182
- },
183
- hexToAnsi: {
184
- value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
185
- enumerable: false
186
- }
187
- });
188
- return styles;
189
- }
190
- var ansiStyles = assembleStyles();
191
- var ansi_styles_default = ansiStyles;
192
-
193
- // ../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
194
- import process from "node:process";
195
- import os from "node:os";
196
- import tty from "node:tty";
197
- function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) {
198
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
199
- const position = argv.indexOf(prefix + flag);
200
- const terminatorPosition = argv.indexOf("--");
201
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
202
- }
203
- var { env } = process;
204
- var flagForceColor;
205
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
206
- flagForceColor = 0;
207
- } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
208
- flagForceColor = 1;
209
- }
210
- function envForceColor() {
211
- if ("FORCE_COLOR" in env) {
212
- if (env.FORCE_COLOR === "true") {
213
- return 1;
214
- }
215
- if (env.FORCE_COLOR === "false") {
216
- return 0;
217
- }
218
- return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
219
- }
220
- }
221
- function translateLevel(level) {
222
- if (level === 0) {
223
- return false;
224
- }
225
- return {
226
- level,
227
- hasBasic: true,
228
- has256: level >= 2,
229
- has16m: level >= 3
230
- };
231
- }
232
- function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
233
- const noFlagForceColor = envForceColor();
234
- if (noFlagForceColor !== void 0) {
235
- flagForceColor = noFlagForceColor;
236
- }
237
- const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
238
- if (forceColor === 0) {
239
- return 0;
240
- }
241
- if (sniffFlags) {
242
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
243
- return 3;
244
- }
245
- if (hasFlag("color=256")) {
246
- return 2;
247
- }
248
- }
249
- if ("TF_BUILD" in env && "AGENT_NAME" in env) {
250
- return 1;
251
- }
252
- if (haveStream && !streamIsTTY && forceColor === void 0) {
253
- return 0;
254
- }
255
- const min = forceColor || 0;
256
- if (env.TERM === "dumb") {
257
- return min;
258
- }
259
- if (process.platform === "win32") {
260
- const osRelease = os.release().split(".");
261
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
262
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
263
- }
264
- return 1;
265
- }
266
- if ("CI" in env) {
267
- if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
268
- return 3;
269
- }
270
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
271
- return 1;
272
- }
273
- return min;
274
- }
275
- if ("TEAMCITY_VERSION" in env) {
276
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
277
- }
278
- if (env.COLORTERM === "truecolor") {
279
- return 3;
280
- }
281
- if (env.TERM === "xterm-kitty") {
282
- return 3;
283
- }
284
- if ("TERM_PROGRAM" in env) {
285
- const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
286
- switch (env.TERM_PROGRAM) {
287
- case "iTerm.app": {
288
- return version >= 3 ? 3 : 2;
289
- }
290
- case "Apple_Terminal": {
291
- return 2;
292
- }
293
- }
294
- }
295
- if (/-256(color)?$/i.test(env.TERM)) {
296
- return 2;
297
- }
298
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
299
- return 1;
300
- }
301
- if ("COLORTERM" in env) {
302
- return 1;
303
- }
304
- return min;
305
- }
306
- function createSupportsColor(stream, options = {}) {
307
- const level = _supportsColor(stream, {
308
- streamIsTTY: stream && stream.isTTY,
309
- ...options
310
- });
311
- return translateLevel(level);
312
- }
313
- var supportsColor = {
314
- stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
315
- stderr: createSupportsColor({ isTTY: tty.isatty(2) })
316
- };
317
- var supports_color_default = supportsColor;
318
-
319
- // ../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
320
- function stringReplaceAll(string, substring, replacer) {
321
- let index = string.indexOf(substring);
322
- if (index === -1) {
323
- return string;
324
- }
325
- const substringLength = substring.length;
326
- let endIndex = 0;
327
- let returnValue = "";
328
- do {
329
- returnValue += string.slice(endIndex, index) + substring + replacer;
330
- endIndex = index + substringLength;
331
- index = string.indexOf(substring, endIndex);
332
- } while (index !== -1);
333
- returnValue += string.slice(endIndex);
334
- return returnValue;
335
- }
336
- function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
337
- let endIndex = 0;
338
- let returnValue = "";
339
- do {
340
- const gotCR = string[index - 1] === "\r";
341
- returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
342
- endIndex = index + 1;
343
- index = string.indexOf("\n", endIndex);
344
- } while (index !== -1);
345
- returnValue += string.slice(endIndex);
346
- return returnValue;
347
- }
348
-
349
- // ../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
350
- var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
351
- var GENERATOR = Symbol("GENERATOR");
352
- var STYLER = Symbol("STYLER");
353
- var IS_EMPTY = Symbol("IS_EMPTY");
354
- var levelMapping = [
355
- "ansi",
356
- "ansi",
357
- "ansi256",
358
- "ansi16m"
359
- ];
360
- var styles2 = /* @__PURE__ */ Object.create(null);
361
- var applyOptions = (object, options = {}) => {
362
- if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
363
- throw new Error("The `level` option should be an integer from 0 to 3");
364
- }
365
- const colorLevel = stdoutColor ? stdoutColor.level : 0;
366
- object.level = options.level === void 0 ? colorLevel : options.level;
367
- };
368
- var Chalk = class {
369
- constructor(options) {
370
- return chalkFactory(options);
371
- }
372
- };
373
- var chalkFactory = (options) => {
374
- const chalk2 = (...strings) => strings.join(" ");
375
- applyOptions(chalk2, options);
376
- Object.setPrototypeOf(chalk2, createChalk.prototype);
377
- return chalk2;
378
- };
379
- function createChalk(options) {
380
- return chalkFactory(options);
381
- }
382
- Object.setPrototypeOf(createChalk.prototype, Function.prototype);
383
- for (const [styleName, style] of Object.entries(ansi_styles_default)) {
384
- styles2[styleName] = {
385
- get() {
386
- const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
387
- Object.defineProperty(this, styleName, { value: builder });
388
- return builder;
389
- }
390
- };
391
- }
392
- styles2.visible = {
393
- get() {
394
- const builder = createBuilder(this, this[STYLER], true);
395
- Object.defineProperty(this, "visible", { value: builder });
396
- return builder;
397
- }
398
- };
399
- var getModelAnsi = (model, level, type, ...arguments_) => {
400
- if (model === "rgb") {
401
- if (level === "ansi16m") {
402
- return ansi_styles_default[type].ansi16m(...arguments_);
403
- }
404
- if (level === "ansi256") {
405
- return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
406
- }
407
- return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
408
- }
409
- if (model === "hex") {
410
- return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
411
- }
412
- return ansi_styles_default[type][model](...arguments_);
413
- };
414
- var usedModels = ["rgb", "hex", "ansi256"];
415
- for (const model of usedModels) {
416
- styles2[model] = {
417
- get() {
418
- const { level } = this;
419
- return function(...arguments_) {
420
- const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
421
- return createBuilder(this, styler, this[IS_EMPTY]);
422
- };
423
- }
424
- };
425
- const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
426
- styles2[bgModel] = {
427
- get() {
428
- const { level } = this;
429
- return function(...arguments_) {
430
- const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
431
- return createBuilder(this, styler, this[IS_EMPTY]);
432
- };
433
- }
434
- };
435
- }
436
- var proto = Object.defineProperties(() => {
437
- }, {
438
- ...styles2,
439
- level: {
440
- enumerable: true,
441
- get() {
442
- return this[GENERATOR].level;
443
- },
444
- set(level) {
445
- this[GENERATOR].level = level;
446
- }
447
- }
448
- });
449
- var createStyler = (open, close, parent) => {
450
- let openAll;
451
- let closeAll;
452
- if (parent === void 0) {
453
- openAll = open;
454
- closeAll = close;
455
- } else {
456
- openAll = parent.openAll + open;
457
- closeAll = close + parent.closeAll;
458
- }
459
- return {
460
- open,
461
- close,
462
- openAll,
463
- closeAll,
464
- parent
465
- };
466
- };
467
- var createBuilder = (self, _styler, _isEmpty) => {
468
- const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
469
- Object.setPrototypeOf(builder, proto);
470
- builder[GENERATOR] = self;
471
- builder[STYLER] = _styler;
472
- builder[IS_EMPTY] = _isEmpty;
473
- return builder;
474
- };
475
- var applyStyle = (self, string) => {
476
- if (self.level <= 0 || !string) {
477
- return self[IS_EMPTY] ? "" : string;
478
- }
479
- let styler = self[STYLER];
480
- if (styler === void 0) {
481
- return string;
482
- }
483
- const { openAll, closeAll } = styler;
484
- if (string.includes("\x1B")) {
485
- while (styler !== void 0) {
486
- string = stringReplaceAll(string, styler.close, styler.open);
487
- styler = styler.parent;
488
- }
489
- }
490
- const lfIndex = string.indexOf("\n");
491
- if (lfIndex !== -1) {
492
- string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
493
- }
494
- return openAll + string + closeAll;
495
- };
496
- Object.defineProperties(createChalk.prototype, styles2);
497
- var chalk = createChalk();
498
- var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
499
- var source_default = chalk;
500
-
501
- export {
502
- modifierNames,
503
- foregroundColorNames,
504
- backgroundColorNames,
505
- colorNames,
506
- stdoutColor,
507
- stderrColor,
508
- Chalk,
509
- chalkStderr,
510
- source_default
511
- };
512
- //# sourceMappingURL=chunk-JQRUGUZ3.js.map