vlt 1.0.0-rc.11 → 1.0.0-rc.12
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/{bugs-QUSYBLWY.js → bugs-WQIWLUVW.js} +3 -3
- package/{build-WKF5EVJJ.js → build-GGH5MMW2.js} +2 -2
- package/{chunk-B3YANLCA.js → chunk-3SN5PW72.js} +4 -4
- package/{chunk-B3YANLCA.js.map → chunk-3SN5PW72.js.map} +2 -2
- package/{chunk-R3DCVMWU.js → chunk-5Y5FH5GW.js} +50 -11
- package/chunk-5Y5FH5GW.js.map +7 -0
- package/{chunk-3INOGDEC.js → chunk-GFW3IW7V.js} +2 -2
- package/{chunk-PRDIJ6RX.js → chunk-IRRQUZMX.js} +2 -2
- package/{chunk-G5DVO64E.js → chunk-IVJWC22L.js} +2 -2
- package/{chunk-EAQ7GUJL.js → chunk-LQOHFYR2.js} +2 -2
- package/{chunk-33BJIMPL.js → chunk-TOVIFC5G.js} +2 -2
- package/{chunk-EI37Y3D5.js → chunk-U6XIBBMI.js} +21 -21
- package/{ci-K3FB6Y6G.js → ci-DBO7FXYA.js} +2 -2
- package/cli-package.json +1 -1
- package/{docs-37QPQOHJ.js → docs-7V2FQGZZ.js} +3 -3
- package/{exec-VOQOMSQZ.js → exec-YTEQ537E.js} +5 -5
- package/{exec-cache-UJIOTIUA.js → exec-cache-VV527ORS.js} +3 -3
- package/{exec-local-VRIVYVKQ.js → exec-local-FNL4C4BI.js} +4 -4
- package/{help-AOPTYVTN.js → help-JRWFHTVV.js} +2 -2
- package/{install-CVVCRNX2.js → install-22MMBNQ6.js} +3 -3
- package/{list-R6MN3CMC.js → list-LGBQS6H2.js} +4 -4
- package/{pack-M2VSSNEE.js → pack-CXBWU4LR.js} +3 -3
- package/package.json +1 -1
- package/{pkg-S746UETL.js → pkg-BHBDVVCN.js} +3 -3
- package/{publish-TMPC2U53.js → publish-4UXZMYNN.js} +3 -3
- package/{query-5KTGYC75.js → query-GG5C7WXM.js} +4 -4
- package/registry-client-package.json +1 -1
- package/{run-5EPMVQTN.js → run-7BFRLGCU.js} +4 -4
- package/{run-exec-6FC3YUIA.js → run-exec-LUWPOAIB.js} +4 -4
- package/{serve-4J22YKX7.js → serve-RKIO2G6M.js} +6 -6
- package/{src-JYKLXMIE.js → src-YKXL5M6Q.js} +2 -2
- package/{uninstall-WLEAR7UD.js → uninstall-6WDI34DI.js} +3 -3
- package/{update-3JSBYJZ4.js → update-WT7I7RIW.js} +2 -2
- package/{version-IURCEFTL.js → version-QENW6HNS.js} +3 -3
- package/vlr.js +1 -1
- package/vlrx.js +1 -1
- package/vlt.js +1 -1
- package/vlx.js +1 -1
- package/vlxl.js +1 -1
- package/chunk-R3DCVMWU.js.map +0 -7
- /package/{bugs-QUSYBLWY.js.map → bugs-WQIWLUVW.js.map} +0 -0
- /package/{build-WKF5EVJJ.js.map → build-GGH5MMW2.js.map} +0 -0
- /package/{chunk-3INOGDEC.js.map → chunk-GFW3IW7V.js.map} +0 -0
- /package/{chunk-PRDIJ6RX.js.map → chunk-IRRQUZMX.js.map} +0 -0
- /package/{chunk-G5DVO64E.js.map → chunk-IVJWC22L.js.map} +0 -0
- /package/{chunk-EAQ7GUJL.js.map → chunk-LQOHFYR2.js.map} +0 -0
- /package/{chunk-33BJIMPL.js.map → chunk-TOVIFC5G.js.map} +0 -0
- /package/{chunk-EI37Y3D5.js.map → chunk-U6XIBBMI.js.map} +0 -0
- /package/{ci-K3FB6Y6G.js.map → ci-DBO7FXYA.js.map} +0 -0
- /package/{docs-37QPQOHJ.js.map → docs-7V2FQGZZ.js.map} +0 -0
- /package/{exec-VOQOMSQZ.js.map → exec-YTEQ537E.js.map} +0 -0
- /package/{exec-cache-UJIOTIUA.js.map → exec-cache-VV527ORS.js.map} +0 -0
- /package/{exec-local-VRIVYVKQ.js.map → exec-local-FNL4C4BI.js.map} +0 -0
- /package/{help-AOPTYVTN.js.map → help-JRWFHTVV.js.map} +0 -0
- /package/{install-CVVCRNX2.js.map → install-22MMBNQ6.js.map} +0 -0
- /package/{list-R6MN3CMC.js.map → list-LGBQS6H2.js.map} +0 -0
- /package/{pack-M2VSSNEE.js.map → pack-CXBWU4LR.js.map} +0 -0
- /package/{pkg-S746UETL.js.map → pkg-BHBDVVCN.js.map} +0 -0
- /package/{publish-TMPC2U53.js.map → publish-4UXZMYNN.js.map} +0 -0
- /package/{query-5KTGYC75.js.map → query-GG5C7WXM.js.map} +0 -0
- /package/{run-5EPMVQTN.js.map → run-7BFRLGCU.js.map} +0 -0
- /package/{run-exec-6FC3YUIA.js.map → run-exec-LUWPOAIB.js.map} +0 -0
- /package/{serve-4J22YKX7.js.map → serve-RKIO2G6M.js.map} +0 -0
- /package/{src-JYKLXMIE.js.map → src-YKXL5M6Q.js.map} +0 -0
- /package/{uninstall-WLEAR7UD.js.map → uninstall-6WDI34DI.js.map} +0 -0
- /package/{update-3JSBYJZ4.js.map → update-WT7I7RIW.js.map} +0 -0
- /package/{version-IURCEFTL.js.map → version-QENW6HNS.js.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js", "../../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js", "../../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js", "../../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js", "../../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js", "../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js", "../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js", "../../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js", "../../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js", "../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js", "../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js", "../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js", "../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/util/unesc.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/util/getProp.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/util/ensureObject.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/util/stripComments.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/util/index.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/selectors/node.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/selectors/types.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/selectors/container.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/selectors/root.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/selectors/selector.js", "../../../node_modules/.pnpm/cssesc@3.0.0/node_modules/cssesc/cssesc.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/selectors/className.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/selectors/comment.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/selectors/id.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/selectors/namespace.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/selectors/tag.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/selectors/string.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/selectors/pseudo.js", "../../../node_modules/.pnpm/util-deprecate@1.0.2/node_modules/util-deprecate/node.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/selectors/attribute.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/selectors/universal.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/selectors/combinator.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/selectors/nesting.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/sortAscending.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/tokenTypes.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/tokenize.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/parser.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/processor.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/selectors/constructors.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/selectors/guards.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/selectors/index.js", "../../../node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/index.js", "../../../src/satisfies/src/index.ts", "../../../src/graph/src/edge.ts", "../../../src/graph/src/stringify-node.ts", "../../../src/graph/src/node.ts", "../../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/src/signals.ts", "../../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/src/index.ts", "../../../node_modules/.pnpm/foreground-child@3.3.1/node_modules/foreground-child/src/index.ts", "../../../node_modules/.pnpm/foreground-child@3.3.1/node_modules/foreground-child/src/all-signals.ts", "../../../node_modules/.pnpm/foreground-child@3.3.1/node_modules/foreground-child/src/proxy-signals.ts", "../../../node_modules/.pnpm/foreground-child@3.3.1/node_modules/foreground-child/src/watchdog.ts", "../../../src/run/src/index.ts", "../../../src/run/src/aliasRunner.ts", "../../../src/dss-parser/src/index.ts", "../../../src/dss-parser/src/types.ts", "../../../src/query/src/pseudo/helpers.ts", "../../../src/query/src/attribute.ts", "../../../src/query/src/combinator.ts", "../../../src/query/src/id.ts", "../../../src/query/src/pseudo/abandoned.ts", "../../../src/query/src/pseudo/attr.ts", "../../../src/query/src/pseudo/built.ts", "../../../src/query/src/pseudo/confused.ts", "../../../src/query/src/pseudo/cve.ts", "../../../src/query/src/pseudo/cwe.ts", "../../../src/query/src/pseudo/debug.ts", "../../../src/query/src/pseudo/deprecated.ts", "../../../src/query/src/pseudo/dev.ts", "../../../src/query/src/pseudo/dynamic.ts", "../../../src/query/src/pseudo/empty.ts", "../../../src/query/src/pseudo/entropic.ts", "../../../src/query/src/pseudo/env.ts", "../../../src/query/src/pseudo/eval.ts", "../../../src/query/src/pseudo/fs.ts", "../../../src/query/src/pseudo/host.ts", "../../../src/query/src/pseudo/license.ts", "../../../src/query/src/pseudo/link.ts", "../../../src/query/src/pseudo/malware.ts", "../../../src/query/src/pseudo/minified.ts", "../../../src/query/src/pseudo/missing.ts", "../../../src/query/src/pseudo/native.ts", "../../../src/query/src/pseudo/network.ts", "../../../src/query/src/pseudo/obfuscated.ts", "../../../src/query/src/pseudo/optional.ts", "../../../node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.js", "../../../node_modules/.pnpm/p-retry@7.1.1/node_modules/p-retry/index.js", "../../../src/query/src/pseudo/outdated.ts", "../../../src/query/src/pseudo/overridden.ts", "../../../src/query/src/pseudo/path.ts", "../../../src/query/src/pseudo/peer.ts", "../../../src/query/src/pseudo/prerelease.ts", "../../../src/query/src/pseudo/published.ts", "../../../src/query/src/pseudo/private.ts", "../../../src/query/src/pseudo/prod.ts", "../../../src/query/src/pseudo/root.ts", "../../../src/query/src/pseudo/scanned.ts", "../../../src/query/src/pseudo/score.ts", "../../../src/query/src/pseudo/scripts.ts", "../../../src/query/src/pseudo/shell.ts", "../../../src/query/src/pseudo/semver.ts", "../../../src/query/src/pseudo/severity.ts", "../../../src/query/src/pseudo/spec.ts", "../../../src/query/src/pseudo/shrinkwrap.ts", "../../../src/query/src/pseudo/squat.ts", "../../../src/query/src/pseudo/suspicious.ts", "../../../src/query/src/pseudo/tracker.ts", "../../../src/query/src/pseudo/trivial.ts", "../../../src/query/src/pseudo/type.ts", "../../../src/query/src/pseudo/undesirable.ts", "../../../src/query/src/pseudo/unknown.ts", "../../../src/query/src/pseudo/unmaintained.ts", "../../../src/query/src/pseudo/unpopular.ts", "../../../src/query/src/pseudo/unstable.ts", "../../../src/query/src/pseudo/workspace.ts", "../../../src/query/src/pseudo.ts", "../../../src/query/src/index.ts", "../../../src/security-archive/src/index.ts", "../../../src/security-archive/src/types.ts", "../../../src/graph/src/dependencies.ts", "../../../src/graph/src/graph.ts", "../../../src/graph/src/lockfile/save.ts", "../../../src/graph/src/lockfile/types.ts", "../../../src/graph/src/resolve-save-type.ts", "../../../src/graph/src/lockfile/load.ts", "../../../src/graph/src/lockfile/load-edges.ts", "../../../src/graph/src/lockfile/load-nodes.ts", "../../../src/graph/src/actual/load.ts", "../../../src/graph/src/reify/build.ts", "../../../src/graph/src/non-empty-list.ts", "../../../src/graph/src/remove-optional-subgraph.ts", "../../../src/graph/src/reify/optional-fail.ts", "../../../src/graph/src/reify/bin-chmod.ts", "../../../src/graph/src/diff.ts", "../../../src/graph/src/build.ts", "../../../src/graph/src/visualization/json-output.ts", "../../../src/graph/src/visualization/human-readable-output.ts", "../../../src/graph/src/visualization/mermaid-output.ts", "../../../src/rollback-remove/src/index.ts", "../../../src/rollback-remove/src/remove.ts", "../../../src/dss-breadcrumb/src/index.ts", "../../../src/graph/src/modifiers.ts", "../../../src/graph/src/ideal/remove-satisfied-specs.ts", "../../../src/graph/src/ideal/get-importer-specs.ts", "../../../src/graph/src/fixup-added-names.ts", "../../../src/graph/src/reify/extract-node.ts", "../../../src/graph/src/ideal/get-ordered-dependencies.ts", "../../../src/graph/src/ideal/peers.ts", "../../../src/graph/src/ideal/append-nodes.ts", "../../../src/graph/src/ideal/refresh-ideal-graph.ts", "../../../src/graph/src/ideal/build-ideal-from-starting-graph.ts", "../../../src/graph/src/ideal/build.ts", "../../../src/graph/src/reify/index.ts", "../../../node_modules/.pnpm/promise-call-limit@3.0.2/node_modules/promise-call-limit/src/index.ts", "../../../src/cmd-shim/src/index.ts", "../../../src/cmd-shim/src/to-batch-syntax.ts", "../../../src/cmd-shim/src/read.ts", "../../../src/cmd-shim/src/paths.ts", "../../../src/graph/src/reify/add-edge.ts", "../../../src/graph/src/reify/add-edges.ts", "../../../src/graph/src/reify/add-nodes.ts", "../../../src/graph/src/reify/delete-edge.ts", "../../../src/graph/src/reify/delete-edges.ts", "../../../src/graph/src/reify/check-needed-build.ts", "../../../src/graph/src/reify/delete-nodes.ts", "../../../src/graph/src/reify/internal-hoist.ts", "../../../src/graph/src/reify/rollback.ts", "../../../src/graph/src/reify/calculate-save-value.ts", "../../../src/graph/src/reify/update-importers-package-json.ts", "../../../src/graph/src/install.ts", "../../../src/graph/src/uninstall.ts", "../../../src/graph/src/update.ts", "../../../src/graph/src/virtual-root.ts", "../../../src/graph/src/index.ts"],
|
|
4
|
+
"sourcesContent": ["module.exports = isexe\nisexe.sync = sync\n\nvar fs = require('fs')\n\nfunction checkPathExt (path, options) {\n var pathext = options.pathExt !== undefined ?\n options.pathExt : process.env.PATHEXT\n\n if (!pathext) {\n return true\n }\n\n pathext = pathext.split(';')\n if (pathext.indexOf('') !== -1) {\n return true\n }\n for (var i = 0; i < pathext.length; i++) {\n var p = pathext[i].toLowerCase()\n if (p && path.substr(-p.length).toLowerCase() === p) {\n return true\n }\n }\n return false\n}\n\nfunction checkStat (stat, path, options) {\n if (!stat.isSymbolicLink() && !stat.isFile()) {\n return false\n }\n return checkPathExt(path, options)\n}\n\nfunction isexe (path, options, cb) {\n fs.stat(path, function (er, stat) {\n cb(er, er ? false : checkStat(stat, path, options))\n })\n}\n\nfunction sync (path, options) {\n return checkStat(fs.statSync(path), path, options)\n}\n", "module.exports = isexe\nisexe.sync = sync\n\nvar fs = require('fs')\n\nfunction isexe (path, options, cb) {\n fs.stat(path, function (er, stat) {\n cb(er, er ? false : checkStat(stat, options))\n })\n}\n\nfunction sync (path, options) {\n return checkStat(fs.statSync(path), options)\n}\n\nfunction checkStat (stat, options) {\n return stat.isFile() && checkMode(stat, options)\n}\n\nfunction checkMode (stat, options) {\n var mod = stat.mode\n var uid = stat.uid\n var gid = stat.gid\n\n var myUid = options.uid !== undefined ?\n options.uid : process.getuid && process.getuid()\n var myGid = options.gid !== undefined ?\n options.gid : process.getgid && process.getgid()\n\n var u = parseInt('100', 8)\n var g = parseInt('010', 8)\n var o = parseInt('001', 8)\n var ug = u | g\n\n var ret = (mod & o) ||\n (mod & g) && gid === myGid ||\n (mod & u) && uid === myUid ||\n (mod & ug) && myUid === 0\n\n return ret\n}\n", "var fs = require('fs')\nvar core\nif (process.platform === 'win32' || global.TESTING_WINDOWS) {\n core = require('./windows.js')\n} else {\n core = require('./mode.js')\n}\n\nmodule.exports = isexe\nisexe.sync = sync\n\nfunction isexe (path, options, cb) {\n if (typeof options === 'function') {\n cb = options\n options = {}\n }\n\n if (!cb) {\n if (typeof Promise !== 'function') {\n throw new TypeError('callback not provided')\n }\n\n return new Promise(function (resolve, reject) {\n isexe(path, options || {}, function (er, is) {\n if (er) {\n reject(er)\n } else {\n resolve(is)\n }\n })\n })\n }\n\n core(path, options || {}, function (er, is) {\n // ignore EACCES because that just means we aren't allowed to run it\n if (er) {\n if (er.code === 'EACCES' || options && options.ignoreErrors) {\n er = null\n is = false\n }\n }\n cb(er, is)\n })\n}\n\nfunction sync (path, options) {\n // my kingdom for a filtered catch\n try {\n return core.sync(path, options || {})\n } catch (er) {\n if (options && options.ignoreErrors || er.code === 'EACCES') {\n return false\n } else {\n throw er\n }\n }\n}\n", "const isWindows = process.platform === 'win32' ||\n process.env.OSTYPE === 'cygwin' ||\n process.env.OSTYPE === 'msys'\n\nconst path = require('path')\nconst COLON = isWindows ? ';' : ':'\nconst isexe = require('isexe')\n\nconst getNotFoundError = (cmd) =>\n Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })\n\nconst getPathInfo = (cmd, opt) => {\n const colon = opt.colon || COLON\n\n // If it has a slash, then we don't bother searching the pathenv.\n // just check the file itself, and that's it.\n const pathEnv = cmd.match(/\\//) || isWindows && cmd.match(/\\\\/) ? ['']\n : (\n [\n // windows always checks the cwd first\n ...(isWindows ? [process.cwd()] : []),\n ...(opt.path || process.env.PATH ||\n /* istanbul ignore next: very unusual */ '').split(colon),\n ]\n )\n const pathExtExe = isWindows\n ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM'\n : ''\n const pathExt = isWindows ? pathExtExe.split(colon) : ['']\n\n if (isWindows) {\n if (cmd.indexOf('.') !== -1 && pathExt[0] !== '')\n pathExt.unshift('')\n }\n\n return {\n pathEnv,\n pathExt,\n pathExtExe,\n }\n}\n\nconst which = (cmd, opt, cb) => {\n if (typeof opt === 'function') {\n cb = opt\n opt = {}\n }\n if (!opt)\n opt = {}\n\n const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)\n const found = []\n\n const step = i => new Promise((resolve, reject) => {\n if (i === pathEnv.length)\n return opt.all && found.length ? resolve(found)\n : reject(getNotFoundError(cmd))\n\n const ppRaw = pathEnv[i]\n const pathPart = /^\".*\"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw\n\n const pCmd = path.join(pathPart, cmd)\n const p = !pathPart && /^\\.[\\\\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd\n : pCmd\n\n resolve(subStep(p, i, 0))\n })\n\n const subStep = (p, i, ii) => new Promise((resolve, reject) => {\n if (ii === pathExt.length)\n return resolve(step(i + 1))\n const ext = pathExt[ii]\n isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {\n if (!er && is) {\n if (opt.all)\n found.push(p + ext)\n else\n return resolve(p + ext)\n }\n return resolve(subStep(p, i, ii + 1))\n })\n })\n\n return cb ? step(0).then(res => cb(null, res), cb) : step(0)\n}\n\nconst whichSync = (cmd, opt) => {\n opt = opt || {}\n\n const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)\n const found = []\n\n for (let i = 0; i < pathEnv.length; i ++) {\n const ppRaw = pathEnv[i]\n const pathPart = /^\".*\"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw\n\n const pCmd = path.join(pathPart, cmd)\n const p = !pathPart && /^\\.[\\\\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd\n : pCmd\n\n for (let j = 0; j < pathExt.length; j ++) {\n const cur = p + pathExt[j]\n try {\n const is = isexe.sync(cur, { pathExt: pathExtExe })\n if (is) {\n if (opt.all)\n found.push(cur)\n else\n return cur\n }\n } catch (ex) {}\n }\n }\n\n if (opt.all && found.length)\n return found\n\n if (opt.nothrow)\n return null\n\n throw getNotFoundError(cmd)\n}\n\nmodule.exports = which\nwhich.sync = whichSync\n", "'use strict';\n\nconst pathKey = (options = {}) => {\n\tconst environment = options.env || process.env;\n\tconst platform = options.platform || process.platform;\n\n\tif (platform !== 'win32') {\n\t\treturn 'PATH';\n\t}\n\n\treturn Object.keys(environment).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path';\n};\n\nmodule.exports = pathKey;\n// TODO: Remove this for the next major release\nmodule.exports.default = pathKey;\n", "'use strict';\n\nconst path = require('path');\nconst which = require('which');\nconst getPathKey = require('path-key');\n\nfunction resolveCommandAttempt(parsed, withoutPathExt) {\n const env = parsed.options.env || process.env;\n const cwd = process.cwd();\n const hasCustomCwd = parsed.options.cwd != null;\n // Worker threads do not have process.chdir()\n const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled;\n\n // If a custom `cwd` was specified, we need to change the process cwd\n // because `which` will do stat calls but does not support a custom cwd\n if (shouldSwitchCwd) {\n try {\n process.chdir(parsed.options.cwd);\n } catch (err) {\n /* Empty */\n }\n }\n\n let resolved;\n\n try {\n resolved = which.sync(parsed.command, {\n path: env[getPathKey({ env })],\n pathExt: withoutPathExt ? path.delimiter : undefined,\n });\n } catch (e) {\n /* Empty */\n } finally {\n if (shouldSwitchCwd) {\n process.chdir(cwd);\n }\n }\n\n // If we successfully resolved, ensure that an absolute path is returned\n // Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it\n if (resolved) {\n resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);\n }\n\n return resolved;\n}\n\nfunction resolveCommand(parsed) {\n return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);\n}\n\nmodule.exports = resolveCommand;\n", "'use strict';\n\n// See http://www.robvanderwoude.com/escapechars.php\nconst metaCharsRegExp = /([()\\][%!^\"`<>&|;, *?])/g;\n\nfunction escapeCommand(arg) {\n // Escape meta chars\n arg = arg.replace(metaCharsRegExp, '^$1');\n\n return arg;\n}\n\nfunction escapeArgument(arg, doubleEscapeMetaChars) {\n // Convert to string\n arg = `${arg}`;\n\n // Algorithm below is based on https://qntm.org/cmd\n // It's slightly altered to disable JS backtracking to avoid hanging on specially crafted input\n // Please see https://github.com/moxystudio/node-cross-spawn/pull/160 for more information\n\n // Sequence of backslashes followed by a double quote:\n // double up all the backslashes and escape the double quote\n arg = arg.replace(/(?=(\\\\+?)?)\\1\"/g, '$1$1\\\\\"');\n\n // Sequence of backslashes followed by the end of the string\n // (which will become a double quote later):\n // double up all the backslashes\n arg = arg.replace(/(?=(\\\\+?)?)\\1$/, '$1$1');\n\n // All other backslashes occur literally\n\n // Quote the whole thing:\n arg = `\"${arg}\"`;\n\n // Escape meta chars\n arg = arg.replace(metaCharsRegExp, '^$1');\n\n // Double escape meta chars if necessary\n if (doubleEscapeMetaChars) {\n arg = arg.replace(metaCharsRegExp, '^$1');\n }\n\n return arg;\n}\n\nmodule.exports.command = escapeCommand;\nmodule.exports.argument = escapeArgument;\n", "'use strict';\nmodule.exports = /^#!(.*)/;\n", "'use strict';\nconst shebangRegex = require('shebang-regex');\n\nmodule.exports = (string = '') => {\n\tconst match = string.match(shebangRegex);\n\n\tif (!match) {\n\t\treturn null;\n\t}\n\n\tconst [path, argument] = match[0].replace(/#! ?/, '').split(' ');\n\tconst binary = path.split('/').pop();\n\n\tif (binary === 'env') {\n\t\treturn argument;\n\t}\n\n\treturn argument ? `${binary} ${argument}` : binary;\n};\n", "'use strict';\n\nconst fs = require('fs');\nconst shebangCommand = require('shebang-command');\n\nfunction readShebang(command) {\n // Read the first 150 bytes from the file\n const size = 150;\n const buffer = Buffer.alloc(size);\n\n let fd;\n\n try {\n fd = fs.openSync(command, 'r');\n fs.readSync(fd, buffer, 0, size, 0);\n fs.closeSync(fd);\n } catch (e) { /* Empty */ }\n\n // Attempt to extract shebang (null is returned if not a shebang)\n return shebangCommand(buffer.toString());\n}\n\nmodule.exports = readShebang;\n", "'use strict';\n\nconst path = require('path');\nconst resolveCommand = require('./util/resolveCommand');\nconst escape = require('./util/escape');\nconst readShebang = require('./util/readShebang');\n\nconst isWin = process.platform === 'win32';\nconst isExecutableRegExp = /\\.(?:com|exe)$/i;\nconst isCmdShimRegExp = /node_modules[\\\\/].bin[\\\\/][^\\\\/]+\\.cmd$/i;\n\nfunction detectShebang(parsed) {\n parsed.file = resolveCommand(parsed);\n\n const shebang = parsed.file && readShebang(parsed.file);\n\n if (shebang) {\n parsed.args.unshift(parsed.file);\n parsed.command = shebang;\n\n return resolveCommand(parsed);\n }\n\n return parsed.file;\n}\n\nfunction parseNonShell(parsed) {\n if (!isWin) {\n return parsed;\n }\n\n // Detect & add support for shebangs\n const commandFile = detectShebang(parsed);\n\n // We don't need a shell if the command filename is an executable\n const needsShell = !isExecutableRegExp.test(commandFile);\n\n // If a shell is required, use cmd.exe and take care of escaping everything correctly\n // Note that `forceShell` is an hidden option used only in tests\n if (parsed.options.forceShell || needsShell) {\n // Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/`\n // The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument\n // Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called,\n // we need to double escape them\n const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);\n\n // Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\\bar)\n // This is necessary otherwise it will always fail with ENOENT in those cases\n parsed.command = path.normalize(parsed.command);\n\n // Escape command & arguments\n parsed.command = escape.command(parsed.command);\n parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));\n\n const shellCommand = [parsed.command].concat(parsed.args).join(' ');\n\n parsed.args = ['/d', '/s', '/c', `\"${shellCommand}\"`];\n parsed.command = process.env.comspec || 'cmd.exe';\n parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped\n }\n\n return parsed;\n}\n\nfunction parse(command, args, options) {\n // Normalize arguments, similar to nodejs\n if (args && !Array.isArray(args)) {\n options = args;\n args = null;\n }\n\n args = args ? args.slice(0) : []; // Clone array to avoid changing the original\n options = Object.assign({}, options); // Clone object to avoid changing the original\n\n // Build our parsed object\n const parsed = {\n command,\n args,\n options,\n file: undefined,\n original: {\n command,\n args,\n },\n };\n\n // Delegate further parsing to shell or non-shell\n return options.shell ? parsed : parseNonShell(parsed);\n}\n\nmodule.exports = parse;\n", "'use strict';\n\nconst isWin = process.platform === 'win32';\n\nfunction notFoundError(original, syscall) {\n return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {\n code: 'ENOENT',\n errno: 'ENOENT',\n syscall: `${syscall} ${original.command}`,\n path: original.command,\n spawnargs: original.args,\n });\n}\n\nfunction hookChildProcess(cp, parsed) {\n if (!isWin) {\n return;\n }\n\n const originalEmit = cp.emit;\n\n cp.emit = function (name, arg1) {\n // If emitting \"exit\" event and exit code is 1, we need to check if\n // the command exists and emit an \"error\" instead\n // See https://github.com/IndigoUnited/node-cross-spawn/issues/16\n if (name === 'exit') {\n const err = verifyENOENT(arg1, parsed);\n\n if (err) {\n return originalEmit.call(cp, 'error', err);\n }\n }\n\n return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params\n };\n}\n\nfunction verifyENOENT(status, parsed) {\n if (isWin && status === 1 && !parsed.file) {\n return notFoundError(parsed.original, 'spawn');\n }\n\n return null;\n}\n\nfunction verifyENOENTSync(status, parsed) {\n if (isWin && status === 1 && !parsed.file) {\n return notFoundError(parsed.original, 'spawnSync');\n }\n\n return null;\n}\n\nmodule.exports = {\n hookChildProcess,\n verifyENOENT,\n verifyENOENTSync,\n notFoundError,\n};\n", "'use strict';\n\nconst cp = require('child_process');\nconst parse = require('./lib/parse');\nconst enoent = require('./lib/enoent');\n\nfunction spawn(command, args, options) {\n // Parse the arguments\n const parsed = parse(command, args, options);\n\n // Spawn the child process\n const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);\n\n // Hook into child process \"exit\" event to emit an error if the command\n // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16\n enoent.hookChildProcess(spawned, parsed);\n\n return spawned;\n}\n\nfunction spawnSync(command, args, options) {\n // Parse the arguments\n const parsed = parse(command, args, options);\n\n // Spawn the child process\n const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);\n\n // Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16\n result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);\n\n return result;\n}\n\nmodule.exports = spawn;\nmodule.exports.spawn = spawn;\nmodule.exports.sync = spawnSync;\n\nmodule.exports._parse = parse;\nmodule.exports._enoent = enoent;\n", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = unesc;\n// Many thanks for this post which made this migration much easier.\n// https://mathiasbynens.be/notes/css-escapes\n\n/**\n * \n * @param {string} str \n * @returns {[string, number]|undefined}\n */\nfunction gobbleHex(str) {\n var lower = str.toLowerCase();\n var hex = '';\n var spaceTerminated = false;\n for (var i = 0; i < 6 && lower[i] !== undefined; i++) {\n var code = lower.charCodeAt(i);\n // check to see if we are dealing with a valid hex char [a-f|0-9]\n var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57;\n // https://drafts.csswg.org/css-syntax/#consume-escaped-code-point\n spaceTerminated = code === 32;\n if (!valid) {\n break;\n }\n hex += lower[i];\n }\n if (hex.length === 0) {\n return undefined;\n }\n var codePoint = parseInt(hex, 16);\n var isSurrogate = codePoint >= 0xD800 && codePoint <= 0xDFFF;\n // Add special case for\n // \"If this number is zero, or is for a surrogate, or is greater than the maximum allowed code point\"\n // https://drafts.csswg.org/css-syntax/#maximum-allowed-code-point\n if (isSurrogate || codePoint === 0x0000 || codePoint > 0x10FFFF) {\n return [\"\\uFFFD\", hex.length + (spaceTerminated ? 1 : 0)];\n }\n return [String.fromCodePoint(codePoint), hex.length + (spaceTerminated ? 1 : 0)];\n}\nvar CONTAINS_ESCAPE = /\\\\/;\nfunction unesc(str) {\n var needToProcess = CONTAINS_ESCAPE.test(str);\n if (!needToProcess) {\n return str;\n }\n var ret = \"\";\n for (var i = 0; i < str.length; i++) {\n if (str[i] === \"\\\\\") {\n var gobbled = gobbleHex(str.slice(i + 1, i + 7));\n if (gobbled !== undefined) {\n ret += gobbled[0];\n i += gobbled[1];\n continue;\n }\n\n // Retain a pair of \\\\ if double escaped `\\\\\\\\`\n // https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e\n if (str[i + 1] === \"\\\\\") {\n ret += \"\\\\\";\n i++;\n continue;\n }\n\n // if \\\\ is at the end of the string retain it\n // https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb\n if (str.length === i + 1) {\n ret += str[i];\n }\n continue;\n }\n ret += str[i];\n }\n return ret;\n}\nmodule.exports = exports.default;", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = getProp;\nfunction getProp(obj) {\n for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n props[_key - 1] = arguments[_key];\n }\n while (props.length > 0) {\n var prop = props.shift();\n if (!obj[prop]) {\n return undefined;\n }\n obj = obj[prop];\n }\n return obj;\n}\nmodule.exports = exports.default;", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = ensureObject;\nfunction ensureObject(obj) {\n for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n props[_key - 1] = arguments[_key];\n }\n while (props.length > 0) {\n var prop = props.shift();\n if (!obj[prop]) {\n obj[prop] = {};\n }\n obj = obj[prop];\n }\n}\nmodule.exports = exports.default;", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = stripComments;\nfunction stripComments(str) {\n var s = \"\";\n var commentStart = str.indexOf(\"/*\");\n var lastEnd = 0;\n while (commentStart >= 0) {\n s = s + str.slice(lastEnd, commentStart);\n var commentEnd = str.indexOf(\"*/\", commentStart + 2);\n if (commentEnd < 0) {\n return s;\n }\n lastEnd = commentEnd + 2;\n commentStart = str.indexOf(\"/*\", lastEnd);\n }\n s = s + str.slice(lastEnd);\n return s;\n}\nmodule.exports = exports.default;", "\"use strict\";\n\nexports.__esModule = true;\nexports.unesc = exports.stripComments = exports.getProp = exports.ensureObject = void 0;\nvar _unesc = _interopRequireDefault(require(\"./unesc\"));\nexports.unesc = _unesc[\"default\"];\nvar _getProp = _interopRequireDefault(require(\"./getProp\"));\nexports.getProp = _getProp[\"default\"];\nvar _ensureObject = _interopRequireDefault(require(\"./ensureObject\"));\nexports.ensureObject = _ensureObject[\"default\"];\nvar _stripComments = _interopRequireDefault(require(\"./stripComments\"));\nexports.stripComments = _stripComments[\"default\"];\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\nvar _util = require(\"../util\");\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nvar cloneNode = function cloneNode(obj, parent) {\n if (typeof obj !== 'object' || obj === null) {\n return obj;\n }\n var cloned = new obj.constructor();\n for (var i in obj) {\n if (!obj.hasOwnProperty(i)) {\n continue;\n }\n var value = obj[i];\n var type = typeof value;\n if (i === 'parent' && type === 'object') {\n if (parent) {\n cloned[i] = parent;\n }\n } else if (value instanceof Array) {\n cloned[i] = value.map(function (j) {\n return cloneNode(j, cloned);\n });\n } else {\n cloned[i] = cloneNode(value, cloned);\n }\n }\n return cloned;\n};\nvar Node = /*#__PURE__*/function () {\n function Node(opts) {\n if (opts === void 0) {\n opts = {};\n }\n Object.assign(this, opts);\n this.spaces = this.spaces || {};\n this.spaces.before = this.spaces.before || '';\n this.spaces.after = this.spaces.after || '';\n }\n var _proto = Node.prototype;\n _proto.remove = function remove() {\n if (this.parent) {\n this.parent.removeChild(this);\n }\n this.parent = undefined;\n return this;\n };\n _proto.replaceWith = function replaceWith() {\n if (this.parent) {\n for (var index in arguments) {\n this.parent.insertBefore(this, arguments[index]);\n }\n this.remove();\n }\n return this;\n };\n _proto.next = function next() {\n return this.parent.at(this.parent.index(this) + 1);\n };\n _proto.prev = function prev() {\n return this.parent.at(this.parent.index(this) - 1);\n };\n _proto.clone = function clone(overrides) {\n if (overrides === void 0) {\n overrides = {};\n }\n var cloned = cloneNode(this);\n for (var name in overrides) {\n cloned[name] = overrides[name];\n }\n return cloned;\n }\n\n /**\n * Some non-standard syntax doesn't follow normal escaping rules for css.\n * This allows non standard syntax to be appended to an existing property\n * by specifying the escaped value. By specifying the escaped value,\n * illegal characters are allowed to be directly inserted into css output.\n * @param {string} name the property to set\n * @param {any} value the unescaped value of the property\n * @param {string} valueEscaped optional. the escaped value of the property.\n */;\n _proto.appendToPropertyAndEscape = function appendToPropertyAndEscape(name, value, valueEscaped) {\n if (!this.raws) {\n this.raws = {};\n }\n var originalValue = this[name];\n var originalEscaped = this.raws[name];\n this[name] = originalValue + value; // this may trigger a setter that updates raws, so it has to be set first.\n if (originalEscaped || valueEscaped !== value) {\n this.raws[name] = (originalEscaped || originalValue) + valueEscaped;\n } else {\n delete this.raws[name]; // delete any escaped value that was created by the setter.\n }\n }\n\n /**\n * Some non-standard syntax doesn't follow normal escaping rules for css.\n * This allows the escaped value to be specified directly, allowing illegal\n * characters to be directly inserted into css output.\n * @param {string} name the property to set\n * @param {any} value the unescaped value of the property\n * @param {string} valueEscaped the escaped value of the property.\n */;\n _proto.setPropertyAndEscape = function setPropertyAndEscape(name, value, valueEscaped) {\n if (!this.raws) {\n this.raws = {};\n }\n this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.\n this.raws[name] = valueEscaped;\n }\n\n /**\n * When you want a value to passed through to CSS directly. This method\n * deletes the corresponding raw value causing the stringifier to fallback\n * to the unescaped value.\n * @param {string} name the property to set.\n * @param {any} value The value that is both escaped and unescaped.\n */;\n _proto.setPropertyWithoutEscape = function setPropertyWithoutEscape(name, value) {\n this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.\n if (this.raws) {\n delete this.raws[name];\n }\n }\n\n /**\n *\n * @param {number} line The number (starting with 1)\n * @param {number} column The column number (starting with 1)\n */;\n _proto.isAtPosition = function isAtPosition(line, column) {\n if (this.source && this.source.start && this.source.end) {\n if (this.source.start.line > line) {\n return false;\n }\n if (this.source.end.line < line) {\n return false;\n }\n if (this.source.start.line === line && this.source.start.column > column) {\n return false;\n }\n if (this.source.end.line === line && this.source.end.column < column) {\n return false;\n }\n return true;\n }\n return undefined;\n };\n _proto.stringifyProperty = function stringifyProperty(name) {\n return this.raws && this.raws[name] || this[name];\n };\n _proto.valueToString = function valueToString() {\n return String(this.stringifyProperty(\"value\"));\n };\n _proto.toString = function toString() {\n return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join('');\n };\n _createClass(Node, [{\n key: \"rawSpaceBefore\",\n get: function get() {\n var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before;\n if (rawSpace === undefined) {\n rawSpace = this.spaces && this.spaces.before;\n }\n return rawSpace || \"\";\n },\n set: function set(raw) {\n (0, _util.ensureObject)(this, \"raws\", \"spaces\");\n this.raws.spaces.before = raw;\n }\n }, {\n key: \"rawSpaceAfter\",\n get: function get() {\n var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after;\n if (rawSpace === undefined) {\n rawSpace = this.spaces.after;\n }\n return rawSpace || \"\";\n },\n set: function set(raw) {\n (0, _util.ensureObject)(this, \"raws\", \"spaces\");\n this.raws.spaces.after = raw;\n }\n }]);\n return Node;\n}();\nexports[\"default\"] = Node;\nmodule.exports = exports.default;", "\"use strict\";\n\nexports.__esModule = true;\nexports.UNIVERSAL = exports.TAG = exports.STRING = exports.SELECTOR = exports.ROOT = exports.PSEUDO = exports.NESTING = exports.ID = exports.COMMENT = exports.COMBINATOR = exports.CLASS = exports.ATTRIBUTE = void 0;\nvar TAG = 'tag';\nexports.TAG = TAG;\nvar STRING = 'string';\nexports.STRING = STRING;\nvar SELECTOR = 'selector';\nexports.SELECTOR = SELECTOR;\nvar ROOT = 'root';\nexports.ROOT = ROOT;\nvar PSEUDO = 'pseudo';\nexports.PSEUDO = PSEUDO;\nvar NESTING = 'nesting';\nexports.NESTING = NESTING;\nvar ID = 'id';\nexports.ID = ID;\nvar COMMENT = 'comment';\nexports.COMMENT = COMMENT;\nvar COMBINATOR = 'combinator';\nexports.COMBINATOR = COMBINATOR;\nvar CLASS = 'class';\nexports.CLASS = CLASS;\nvar ATTRIBUTE = 'attribute';\nexports.ATTRIBUTE = ATTRIBUTE;\nvar UNIVERSAL = 'universal';\nexports.UNIVERSAL = UNIVERSAL;", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\nvar _node = _interopRequireDefault(require(\"./node\"));\nvar types = _interopRequireWildcard(require(\"./types\"));\nfunction _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== \"function\") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }\nfunction _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== \"object\" && typeof obj !== \"function\") { return { \"default\": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj[\"default\"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nfunction _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nvar Container = /*#__PURE__*/function (_Node) {\n _inheritsLoose(Container, _Node);\n function Container(opts) {\n var _this;\n _this = _Node.call(this, opts) || this;\n if (!_this.nodes) {\n _this.nodes = [];\n }\n return _this;\n }\n var _proto = Container.prototype;\n _proto.append = function append(selector) {\n selector.parent = this;\n this.nodes.push(selector);\n return this;\n };\n _proto.prepend = function prepend(selector) {\n selector.parent = this;\n this.nodes.unshift(selector);\n for (var id in this.indexes) {\n this.indexes[id]++;\n }\n return this;\n };\n _proto.at = function at(index) {\n return this.nodes[index];\n };\n _proto.index = function index(child) {\n if (typeof child === 'number') {\n return child;\n }\n return this.nodes.indexOf(child);\n };\n _proto.removeChild = function removeChild(child) {\n child = this.index(child);\n this.at(child).parent = undefined;\n this.nodes.splice(child, 1);\n var index;\n for (var id in this.indexes) {\n index = this.indexes[id];\n if (index >= child) {\n this.indexes[id] = index - 1;\n }\n }\n return this;\n };\n _proto.removeAll = function removeAll() {\n for (var _iterator = _createForOfIteratorHelperLoose(this.nodes), _step; !(_step = _iterator()).done;) {\n var node = _step.value;\n node.parent = undefined;\n }\n this.nodes = [];\n return this;\n };\n _proto.empty = function empty() {\n return this.removeAll();\n };\n _proto.insertAfter = function insertAfter(oldNode, newNode) {\n var _this$nodes;\n newNode.parent = this;\n var oldIndex = this.index(oldNode);\n var resetNode = [];\n for (var i = 2; i < arguments.length; i++) {\n resetNode.push(arguments[i]);\n }\n (_this$nodes = this.nodes).splice.apply(_this$nodes, [oldIndex + 1, 0, newNode].concat(resetNode));\n newNode.parent = this;\n var index;\n for (var id in this.indexes) {\n index = this.indexes[id];\n if (oldIndex < index) {\n this.indexes[id] = index + arguments.length - 1;\n }\n }\n return this;\n };\n _proto.insertBefore = function insertBefore(oldNode, newNode) {\n var _this$nodes2;\n newNode.parent = this;\n var oldIndex = this.index(oldNode);\n var resetNode = [];\n for (var i = 2; i < arguments.length; i++) {\n resetNode.push(arguments[i]);\n }\n (_this$nodes2 = this.nodes).splice.apply(_this$nodes2, [oldIndex, 0, newNode].concat(resetNode));\n newNode.parent = this;\n var index;\n for (var id in this.indexes) {\n index = this.indexes[id];\n if (index >= oldIndex) {\n this.indexes[id] = index + arguments.length - 1;\n }\n }\n return this;\n };\n _proto._findChildAtPosition = function _findChildAtPosition(line, col) {\n var found = undefined;\n this.each(function (node) {\n if (node.atPosition) {\n var foundChild = node.atPosition(line, col);\n if (foundChild) {\n found = foundChild;\n return false;\n }\n } else if (node.isAtPosition(line, col)) {\n found = node;\n return false;\n }\n });\n return found;\n }\n\n /**\n * Return the most specific node at the line and column number given.\n * The source location is based on the original parsed location, locations aren't\n * updated as selector nodes are mutated.\n *\n * Note that this location is relative to the location of the first character\n * of the selector, and not the location of the selector in the overall document\n * when used in conjunction with postcss.\n *\n * If not found, returns undefined.\n * @param {number} line The line number of the node to find. (1-based index)\n * @param {number} col The column number of the node to find. (1-based index)\n */;\n _proto.atPosition = function atPosition(line, col) {\n if (this.isAtPosition(line, col)) {\n return this._findChildAtPosition(line, col) || this;\n } else {\n return undefined;\n }\n };\n _proto._inferEndPosition = function _inferEndPosition() {\n if (this.last && this.last.source && this.last.source.end) {\n this.source = this.source || {};\n this.source.end = this.source.end || {};\n Object.assign(this.source.end, this.last.source.end);\n }\n };\n _proto.each = function each(callback) {\n if (!this.lastEach) {\n this.lastEach = 0;\n }\n if (!this.indexes) {\n this.indexes = {};\n }\n this.lastEach++;\n var id = this.lastEach;\n this.indexes[id] = 0;\n if (!this.length) {\n return undefined;\n }\n var index, result;\n while (this.indexes[id] < this.length) {\n index = this.indexes[id];\n result = callback(this.at(index), index);\n if (result === false) {\n break;\n }\n this.indexes[id] += 1;\n }\n delete this.indexes[id];\n if (result === false) {\n return false;\n }\n };\n _proto.walk = function walk(callback) {\n return this.each(function (node, i) {\n var result = callback(node, i);\n if (result !== false && node.length) {\n result = node.walk(callback);\n }\n if (result === false) {\n return false;\n }\n });\n };\n _proto.walkAttributes = function walkAttributes(callback) {\n var _this2 = this;\n return this.walk(function (selector) {\n if (selector.type === types.ATTRIBUTE) {\n return callback.call(_this2, selector);\n }\n });\n };\n _proto.walkClasses = function walkClasses(callback) {\n var _this3 = this;\n return this.walk(function (selector) {\n if (selector.type === types.CLASS) {\n return callback.call(_this3, selector);\n }\n });\n };\n _proto.walkCombinators = function walkCombinators(callback) {\n var _this4 = this;\n return this.walk(function (selector) {\n if (selector.type === types.COMBINATOR) {\n return callback.call(_this4, selector);\n }\n });\n };\n _proto.walkComments = function walkComments(callback) {\n var _this5 = this;\n return this.walk(function (selector) {\n if (selector.type === types.COMMENT) {\n return callback.call(_this5, selector);\n }\n });\n };\n _proto.walkIds = function walkIds(callback) {\n var _this6 = this;\n return this.walk(function (selector) {\n if (selector.type === types.ID) {\n return callback.call(_this6, selector);\n }\n });\n };\n _proto.walkNesting = function walkNesting(callback) {\n var _this7 = this;\n return this.walk(function (selector) {\n if (selector.type === types.NESTING) {\n return callback.call(_this7, selector);\n }\n });\n };\n _proto.walkPseudos = function walkPseudos(callback) {\n var _this8 = this;\n return this.walk(function (selector) {\n if (selector.type === types.PSEUDO) {\n return callback.call(_this8, selector);\n }\n });\n };\n _proto.walkTags = function walkTags(callback) {\n var _this9 = this;\n return this.walk(function (selector) {\n if (selector.type === types.TAG) {\n return callback.call(_this9, selector);\n }\n });\n };\n _proto.walkUniversals = function walkUniversals(callback) {\n var _this10 = this;\n return this.walk(function (selector) {\n if (selector.type === types.UNIVERSAL) {\n return callback.call(_this10, selector);\n }\n });\n };\n _proto.split = function split(callback) {\n var _this11 = this;\n var current = [];\n return this.reduce(function (memo, node, index) {\n var split = callback.call(_this11, node);\n current.push(node);\n if (split) {\n memo.push(current);\n current = [];\n } else if (index === _this11.length - 1) {\n memo.push(current);\n }\n return memo;\n }, []);\n };\n _proto.map = function map(callback) {\n return this.nodes.map(callback);\n };\n _proto.reduce = function reduce(callback, memo) {\n return this.nodes.reduce(callback, memo);\n };\n _proto.every = function every(callback) {\n return this.nodes.every(callback);\n };\n _proto.some = function some(callback) {\n return this.nodes.some(callback);\n };\n _proto.filter = function filter(callback) {\n return this.nodes.filter(callback);\n };\n _proto.sort = function sort(callback) {\n return this.nodes.sort(callback);\n };\n _proto.toString = function toString() {\n return this.map(String).join('');\n };\n _createClass(Container, [{\n key: \"first\",\n get: function get() {\n return this.at(0);\n }\n }, {\n key: \"last\",\n get: function get() {\n return this.at(this.length - 1);\n }\n }, {\n key: \"length\",\n get: function get() {\n return this.nodes.length;\n }\n }]);\n return Container;\n}(_node[\"default\"]);\nexports[\"default\"] = Container;\nmodule.exports = exports.default;", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\nvar _container = _interopRequireDefault(require(\"./container\"));\nvar _types = require(\"./types\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nvar Root = /*#__PURE__*/function (_Container) {\n _inheritsLoose(Root, _Container);\n function Root(opts) {\n var _this;\n _this = _Container.call(this, opts) || this;\n _this.type = _types.ROOT;\n return _this;\n }\n var _proto = Root.prototype;\n _proto.toString = function toString() {\n var str = this.reduce(function (memo, selector) {\n memo.push(String(selector));\n return memo;\n }, []).join(',');\n return this.trailingComma ? str + ',' : str;\n };\n _proto.error = function error(message, options) {\n if (this._error) {\n return this._error(message, options);\n } else {\n return new Error(message);\n }\n };\n _createClass(Root, [{\n key: \"errorGenerator\",\n set: function set(handler) {\n this._error = handler;\n }\n }]);\n return Root;\n}(_container[\"default\"]);\nexports[\"default\"] = Root;\nmodule.exports = exports.default;", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\nvar _container = _interopRequireDefault(require(\"./container\"));\nvar _types = require(\"./types\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nvar Selector = /*#__PURE__*/function (_Container) {\n _inheritsLoose(Selector, _Container);\n function Selector(opts) {\n var _this;\n _this = _Container.call(this, opts) || this;\n _this.type = _types.SELECTOR;\n return _this;\n }\n return Selector;\n}(_container[\"default\"]);\nexports[\"default\"] = Selector;\nmodule.exports = exports.default;", "/*! https://mths.be/cssesc v3.0.0 by @mathias */\n'use strict';\n\nvar object = {};\nvar hasOwnProperty = object.hasOwnProperty;\nvar merge = function merge(options, defaults) {\n\tif (!options) {\n\t\treturn defaults;\n\t}\n\tvar result = {};\n\tfor (var key in defaults) {\n\t\t// `if (defaults.hasOwnProperty(key) { \u2026 }` is not needed here, since\n\t\t// only recognized option names are used.\n\t\tresult[key] = hasOwnProperty.call(options, key) ? options[key] : defaults[key];\n\t}\n\treturn result;\n};\n\nvar regexAnySingleEscape = /[ -,\\.\\/:-@\\[-\\^`\\{-~]/;\nvar regexSingleEscape = /[ -,\\.\\/:-@\\[\\]\\^`\\{-~]/;\nvar regexAlwaysEscape = /['\"\\\\]/;\nvar regexExcessiveSpaces = /(^|\\\\+)?(\\\\[A-F0-9]{1,6})\\x20(?![a-fA-F0-9\\x20])/g;\n\n// https://mathiasbynens.be/notes/css-escapes#css\nvar cssesc = function cssesc(string, options) {\n\toptions = merge(options, cssesc.options);\n\tif (options.quotes != 'single' && options.quotes != 'double') {\n\t\toptions.quotes = 'single';\n\t}\n\tvar quote = options.quotes == 'double' ? '\"' : '\\'';\n\tvar isIdentifier = options.isIdentifier;\n\n\tvar firstChar = string.charAt(0);\n\tvar output = '';\n\tvar counter = 0;\n\tvar length = string.length;\n\twhile (counter < length) {\n\t\tvar character = string.charAt(counter++);\n\t\tvar codePoint = character.charCodeAt();\n\t\tvar value = void 0;\n\t\t// If it\u2019s not a printable ASCII character\u2026\n\t\tif (codePoint < 0x20 || codePoint > 0x7E) {\n\t\t\tif (codePoint >= 0xD800 && codePoint <= 0xDBFF && counter < length) {\n\t\t\t\t// It\u2019s a high surrogate, and there is a next character.\n\t\t\t\tvar extra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) {\n\t\t\t\t\t// next character is low surrogate\n\t\t\t\t\tcodePoint = ((codePoint & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000;\n\t\t\t\t} else {\n\t\t\t\t\t// It\u2019s an unmatched surrogate; only append this code unit, in case\n\t\t\t\t\t// the next code unit is the high surrogate of a surrogate pair.\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tvalue = '\\\\' + codePoint.toString(16).toUpperCase() + ' ';\n\t\t} else {\n\t\t\tif (options.escapeEverything) {\n\t\t\t\tif (regexAnySingleEscape.test(character)) {\n\t\t\t\t\tvalue = '\\\\' + character;\n\t\t\t\t} else {\n\t\t\t\t\tvalue = '\\\\' + codePoint.toString(16).toUpperCase() + ' ';\n\t\t\t\t}\n\t\t\t} else if (/[\\t\\n\\f\\r\\x0B]/.test(character)) {\n\t\t\t\tvalue = '\\\\' + codePoint.toString(16).toUpperCase() + ' ';\n\t\t\t} else if (character == '\\\\' || !isIdentifier && (character == '\"' && quote == character || character == '\\'' && quote == character) || isIdentifier && regexSingleEscape.test(character)) {\n\t\t\t\tvalue = '\\\\' + character;\n\t\t\t} else {\n\t\t\t\tvalue = character;\n\t\t\t}\n\t\t}\n\t\toutput += value;\n\t}\n\n\tif (isIdentifier) {\n\t\tif (/^-[-\\d]/.test(output)) {\n\t\t\toutput = '\\\\-' + output.slice(1);\n\t\t} else if (/\\d/.test(firstChar)) {\n\t\t\toutput = '\\\\3' + firstChar + ' ' + output.slice(1);\n\t\t}\n\t}\n\n\t// Remove spaces after `\\HEX` escapes that are not followed by a hex digit,\n\t// since they\u2019re redundant. Note that this is only possible if the escape\n\t// sequence isn\u2019t preceded by an odd number of backslashes.\n\toutput = output.replace(regexExcessiveSpaces, function ($0, $1, $2) {\n\t\tif ($1 && $1.length % 2) {\n\t\t\t// It\u2019s not safe to remove the space, so don\u2019t.\n\t\t\treturn $0;\n\t\t}\n\t\t// Strip the space.\n\t\treturn ($1 || '') + $2;\n\t});\n\n\tif (!isIdentifier && options.wrap) {\n\t\treturn quote + output + quote;\n\t}\n\treturn output;\n};\n\n// Expose default options (so they can be overridden globally).\ncssesc.options = {\n\t'escapeEverything': false,\n\t'isIdentifier': false,\n\t'quotes': 'single',\n\t'wrap': false\n};\n\ncssesc.version = '3.0.0';\n\nmodule.exports = cssesc;\n", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\nvar _cssesc = _interopRequireDefault(require(\"cssesc\"));\nvar _util = require(\"../util\");\nvar _node = _interopRequireDefault(require(\"./node\"));\nvar _types = require(\"./types\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nvar ClassName = /*#__PURE__*/function (_Node) {\n _inheritsLoose(ClassName, _Node);\n function ClassName(opts) {\n var _this;\n _this = _Node.call(this, opts) || this;\n _this.type = _types.CLASS;\n _this._constructed = true;\n return _this;\n }\n var _proto = ClassName.prototype;\n _proto.valueToString = function valueToString() {\n return '.' + _Node.prototype.valueToString.call(this);\n };\n _createClass(ClassName, [{\n key: \"value\",\n get: function get() {\n return this._value;\n },\n set: function set(v) {\n if (this._constructed) {\n var escaped = (0, _cssesc[\"default\"])(v, {\n isIdentifier: true\n });\n if (escaped !== v) {\n (0, _util.ensureObject)(this, \"raws\");\n this.raws.value = escaped;\n } else if (this.raws) {\n delete this.raws.value;\n }\n }\n this._value = v;\n }\n }]);\n return ClassName;\n}(_node[\"default\"]);\nexports[\"default\"] = ClassName;\nmodule.exports = exports.default;", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\nvar _node = _interopRequireDefault(require(\"./node\"));\nvar _types = require(\"./types\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nvar Comment = /*#__PURE__*/function (_Node) {\n _inheritsLoose(Comment, _Node);\n function Comment(opts) {\n var _this;\n _this = _Node.call(this, opts) || this;\n _this.type = _types.COMMENT;\n return _this;\n }\n return Comment;\n}(_node[\"default\"]);\nexports[\"default\"] = Comment;\nmodule.exports = exports.default;", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\nvar _node = _interopRequireDefault(require(\"./node\"));\nvar _types = require(\"./types\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nvar ID = /*#__PURE__*/function (_Node) {\n _inheritsLoose(ID, _Node);\n function ID(opts) {\n var _this;\n _this = _Node.call(this, opts) || this;\n _this.type = _types.ID;\n return _this;\n }\n var _proto = ID.prototype;\n _proto.valueToString = function valueToString() {\n return '#' + _Node.prototype.valueToString.call(this);\n };\n return ID;\n}(_node[\"default\"]);\nexports[\"default\"] = ID;\nmodule.exports = exports.default;", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\nvar _cssesc = _interopRequireDefault(require(\"cssesc\"));\nvar _util = require(\"../util\");\nvar _node = _interopRequireDefault(require(\"./node\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nvar Namespace = /*#__PURE__*/function (_Node) {\n _inheritsLoose(Namespace, _Node);\n function Namespace() {\n return _Node.apply(this, arguments) || this;\n }\n var _proto = Namespace.prototype;\n _proto.qualifiedName = function qualifiedName(value) {\n if (this.namespace) {\n return this.namespaceString + \"|\" + value;\n } else {\n return value;\n }\n };\n _proto.valueToString = function valueToString() {\n return this.qualifiedName(_Node.prototype.valueToString.call(this));\n };\n _createClass(Namespace, [{\n key: \"namespace\",\n get: function get() {\n return this._namespace;\n },\n set: function set(namespace) {\n if (namespace === true || namespace === \"*\" || namespace === \"&\") {\n this._namespace = namespace;\n if (this.raws) {\n delete this.raws.namespace;\n }\n return;\n }\n var escaped = (0, _cssesc[\"default\"])(namespace, {\n isIdentifier: true\n });\n this._namespace = namespace;\n if (escaped !== namespace) {\n (0, _util.ensureObject)(this, \"raws\");\n this.raws.namespace = escaped;\n } else if (this.raws) {\n delete this.raws.namespace;\n }\n }\n }, {\n key: \"ns\",\n get: function get() {\n return this._namespace;\n },\n set: function set(namespace) {\n this.namespace = namespace;\n }\n }, {\n key: \"namespaceString\",\n get: function get() {\n if (this.namespace) {\n var ns = this.stringifyProperty(\"namespace\");\n if (ns === true) {\n return '';\n } else {\n return ns;\n }\n } else {\n return '';\n }\n }\n }]);\n return Namespace;\n}(_node[\"default\"]);\nexports[\"default\"] = Namespace;\n;\nmodule.exports = exports.default;", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\nvar _namespace = _interopRequireDefault(require(\"./namespace\"));\nvar _types = require(\"./types\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nvar Tag = /*#__PURE__*/function (_Namespace) {\n _inheritsLoose(Tag, _Namespace);\n function Tag(opts) {\n var _this;\n _this = _Namespace.call(this, opts) || this;\n _this.type = _types.TAG;\n return _this;\n }\n return Tag;\n}(_namespace[\"default\"]);\nexports[\"default\"] = Tag;\nmodule.exports = exports.default;", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\nvar _node = _interopRequireDefault(require(\"./node\"));\nvar _types = require(\"./types\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nvar String = /*#__PURE__*/function (_Node) {\n _inheritsLoose(String, _Node);\n function String(opts) {\n var _this;\n _this = _Node.call(this, opts) || this;\n _this.type = _types.STRING;\n return _this;\n }\n return String;\n}(_node[\"default\"]);\nexports[\"default\"] = String;\nmodule.exports = exports.default;", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\nvar _container = _interopRequireDefault(require(\"./container\"));\nvar _types = require(\"./types\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nvar Pseudo = /*#__PURE__*/function (_Container) {\n _inheritsLoose(Pseudo, _Container);\n function Pseudo(opts) {\n var _this;\n _this = _Container.call(this, opts) || this;\n _this.type = _types.PSEUDO;\n return _this;\n }\n var _proto = Pseudo.prototype;\n _proto.toString = function toString() {\n var params = this.length ? '(' + this.map(String).join(',') + ')' : '';\n return [this.rawSpaceBefore, this.stringifyProperty(\"value\"), params, this.rawSpaceAfter].join('');\n };\n return Pseudo;\n}(_container[\"default\"]);\nexports[\"default\"] = Pseudo;\nmodule.exports = exports.default;", "\n/**\n * For Node.js, simply re-export the core `util.deprecate` function.\n */\n\nmodule.exports = require('util').deprecate;\n", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\nexports.unescapeValue = unescapeValue;\nvar _cssesc = _interopRequireDefault(require(\"cssesc\"));\nvar _unesc = _interopRequireDefault(require(\"../util/unesc\"));\nvar _namespace = _interopRequireDefault(require(\"./namespace\"));\nvar _types = require(\"./types\");\nvar _CSSESC_QUOTE_OPTIONS;\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nvar deprecate = require(\"util-deprecate\");\nvar WRAPPED_IN_QUOTES = /^('|\")([^]*)\\1$/;\nvar warnOfDeprecatedValueAssignment = deprecate(function () {}, \"Assigning an attribute a value containing characters that might need to be escaped is deprecated. \" + \"Call attribute.setValue() instead.\");\nvar warnOfDeprecatedQuotedAssignment = deprecate(function () {}, \"Assigning attr.quoted is deprecated and has no effect. Assign to attr.quoteMark instead.\");\nvar warnOfDeprecatedConstructor = deprecate(function () {}, \"Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now.\");\nfunction unescapeValue(value) {\n var deprecatedUsage = false;\n var quoteMark = null;\n var unescaped = value;\n var m = unescaped.match(WRAPPED_IN_QUOTES);\n if (m) {\n quoteMark = m[1];\n unescaped = m[2];\n }\n unescaped = (0, _unesc[\"default\"])(unescaped);\n if (unescaped !== value) {\n deprecatedUsage = true;\n }\n return {\n deprecatedUsage: deprecatedUsage,\n unescaped: unescaped,\n quoteMark: quoteMark\n };\n}\nfunction handleDeprecatedContructorOpts(opts) {\n if (opts.quoteMark !== undefined) {\n return opts;\n }\n if (opts.value === undefined) {\n return opts;\n }\n warnOfDeprecatedConstructor();\n var _unescapeValue = unescapeValue(opts.value),\n quoteMark = _unescapeValue.quoteMark,\n unescaped = _unescapeValue.unescaped;\n if (!opts.raws) {\n opts.raws = {};\n }\n if (opts.raws.value === undefined) {\n opts.raws.value = opts.value;\n }\n opts.value = unescaped;\n opts.quoteMark = quoteMark;\n return opts;\n}\nvar Attribute = /*#__PURE__*/function (_Namespace) {\n _inheritsLoose(Attribute, _Namespace);\n function Attribute(opts) {\n var _this;\n if (opts === void 0) {\n opts = {};\n }\n _this = _Namespace.call(this, handleDeprecatedContructorOpts(opts)) || this;\n _this.type = _types.ATTRIBUTE;\n _this.raws = _this.raws || {};\n Object.defineProperty(_this.raws, 'unquoted', {\n get: deprecate(function () {\n return _this.value;\n }, \"attr.raws.unquoted is deprecated. Call attr.value instead.\"),\n set: deprecate(function () {\n return _this.value;\n }, \"Setting attr.raws.unquoted is deprecated and has no effect. attr.value is unescaped by default now.\")\n });\n _this._constructed = true;\n return _this;\n }\n\n /**\n * Returns the Attribute's value quoted such that it would be legal to use\n * in the value of a css file. The original value's quotation setting\n * used for stringification is left unchanged. See `setValue(value, options)`\n * if you want to control the quote settings of a new value for the attribute.\n *\n * You can also change the quotation used for the current value by setting quoteMark.\n *\n * Options:\n * * quoteMark {'\"' | \"'\" | null} - Use this value to quote the value. If this\n * option is not set, the original value for quoteMark will be used. If\n * indeterminate, a double quote is used. The legal values are:\n * * `null` - the value will be unquoted and characters will be escaped as necessary.\n * * `'` - the value will be quoted with a single quote and single quotes are escaped.\n * * `\"` - the value will be quoted with a double quote and double quotes are escaped.\n * * preferCurrentQuoteMark {boolean} - if true, prefer the source quote mark\n * over the quoteMark option value.\n * * smart {boolean} - if true, will select a quote mark based on the value\n * and the other options specified here. See the `smartQuoteMark()`\n * method.\n **/\n var _proto = Attribute.prototype;\n _proto.getQuotedValue = function getQuotedValue(options) {\n if (options === void 0) {\n options = {};\n }\n var quoteMark = this._determineQuoteMark(options);\n var cssescopts = CSSESC_QUOTE_OPTIONS[quoteMark];\n var escaped = (0, _cssesc[\"default\"])(this._value, cssescopts);\n return escaped;\n };\n _proto._determineQuoteMark = function _determineQuoteMark(options) {\n return options.smart ? this.smartQuoteMark(options) : this.preferredQuoteMark(options);\n }\n\n /**\n * Set the unescaped value with the specified quotation options. The value\n * provided must not include any wrapping quote marks -- those quotes will\n * be interpreted as part of the value and escaped accordingly.\n */;\n _proto.setValue = function setValue(value, options) {\n if (options === void 0) {\n options = {};\n }\n this._value = value;\n this._quoteMark = this._determineQuoteMark(options);\n this._syncRawValue();\n }\n\n /**\n * Intelligently select a quoteMark value based on the value's contents. If\n * the value is a legal CSS ident, it will not be quoted. Otherwise a quote\n * mark will be picked that minimizes the number of escapes.\n *\n * If there's no clear winner, the quote mark from these options is used,\n * then the source quote mark (this is inverted if `preferCurrentQuoteMark` is\n * true). If the quoteMark is unspecified, a double quote is used.\n *\n * @param options This takes the quoteMark and preferCurrentQuoteMark options\n * from the quoteValue method.\n */;\n _proto.smartQuoteMark = function smartQuoteMark(options) {\n var v = this.value;\n var numSingleQuotes = v.replace(/[^']/g, '').length;\n var numDoubleQuotes = v.replace(/[^\"]/g, '').length;\n if (numSingleQuotes + numDoubleQuotes === 0) {\n var escaped = (0, _cssesc[\"default\"])(v, {\n isIdentifier: true\n });\n if (escaped === v) {\n return Attribute.NO_QUOTE;\n } else {\n var pref = this.preferredQuoteMark(options);\n if (pref === Attribute.NO_QUOTE) {\n // pick a quote mark that isn't none and see if it's smaller\n var quote = this.quoteMark || options.quoteMark || Attribute.DOUBLE_QUOTE;\n var opts = CSSESC_QUOTE_OPTIONS[quote];\n var quoteValue = (0, _cssesc[\"default\"])(v, opts);\n if (quoteValue.length < escaped.length) {\n return quote;\n }\n }\n return pref;\n }\n } else if (numDoubleQuotes === numSingleQuotes) {\n return this.preferredQuoteMark(options);\n } else if (numDoubleQuotes < numSingleQuotes) {\n return Attribute.DOUBLE_QUOTE;\n } else {\n return Attribute.SINGLE_QUOTE;\n }\n }\n\n /**\n * Selects the preferred quote mark based on the options and the current quote mark value.\n * If you want the quote mark to depend on the attribute value, call `smartQuoteMark(opts)`\n * instead.\n */;\n _proto.preferredQuoteMark = function preferredQuoteMark(options) {\n var quoteMark = options.preferCurrentQuoteMark ? this.quoteMark : options.quoteMark;\n if (quoteMark === undefined) {\n quoteMark = options.preferCurrentQuoteMark ? options.quoteMark : this.quoteMark;\n }\n if (quoteMark === undefined) {\n quoteMark = Attribute.DOUBLE_QUOTE;\n }\n return quoteMark;\n };\n _proto._syncRawValue = function _syncRawValue() {\n var rawValue = (0, _cssesc[\"default\"])(this._value, CSSESC_QUOTE_OPTIONS[this.quoteMark]);\n if (rawValue === this._value) {\n if (this.raws) {\n delete this.raws.value;\n }\n } else {\n this.raws.value = rawValue;\n }\n };\n _proto._handleEscapes = function _handleEscapes(prop, value) {\n if (this._constructed) {\n var escaped = (0, _cssesc[\"default\"])(value, {\n isIdentifier: true\n });\n if (escaped !== value) {\n this.raws[prop] = escaped;\n } else {\n delete this.raws[prop];\n }\n }\n };\n _proto._spacesFor = function _spacesFor(name) {\n var attrSpaces = {\n before: '',\n after: ''\n };\n var spaces = this.spaces[name] || {};\n var rawSpaces = this.raws.spaces && this.raws.spaces[name] || {};\n return Object.assign(attrSpaces, spaces, rawSpaces);\n };\n _proto._stringFor = function _stringFor(name, spaceName, concat) {\n if (spaceName === void 0) {\n spaceName = name;\n }\n if (concat === void 0) {\n concat = defaultAttrConcat;\n }\n var attrSpaces = this._spacesFor(spaceName);\n return concat(this.stringifyProperty(name), attrSpaces);\n }\n\n /**\n * returns the offset of the attribute part specified relative to the\n * start of the node of the output string.\n *\n * * \"ns\" - alias for \"namespace\"\n * * \"namespace\" - the namespace if it exists.\n * * \"attribute\" - the attribute name\n * * \"attributeNS\" - the start of the attribute or its namespace\n * * \"operator\" - the match operator of the attribute\n * * \"value\" - The value (string or identifier)\n * * \"insensitive\" - the case insensitivity flag;\n * @param part One of the possible values inside an attribute.\n * @returns -1 if the name is invalid or the value doesn't exist in this attribute.\n */;\n _proto.offsetOf = function offsetOf(name) {\n var count = 1;\n var attributeSpaces = this._spacesFor(\"attribute\");\n count += attributeSpaces.before.length;\n if (name === \"namespace\" || name === \"ns\") {\n return this.namespace ? count : -1;\n }\n if (name === \"attributeNS\") {\n return count;\n }\n count += this.namespaceString.length;\n if (this.namespace) {\n count += 1;\n }\n if (name === \"attribute\") {\n return count;\n }\n count += this.stringifyProperty(\"attribute\").length;\n count += attributeSpaces.after.length;\n var operatorSpaces = this._spacesFor(\"operator\");\n count += operatorSpaces.before.length;\n var operator = this.stringifyProperty(\"operator\");\n if (name === \"operator\") {\n return operator ? count : -1;\n }\n count += operator.length;\n count += operatorSpaces.after.length;\n var valueSpaces = this._spacesFor(\"value\");\n count += valueSpaces.before.length;\n var value = this.stringifyProperty(\"value\");\n if (name === \"value\") {\n return value ? count : -1;\n }\n count += value.length;\n count += valueSpaces.after.length;\n var insensitiveSpaces = this._spacesFor(\"insensitive\");\n count += insensitiveSpaces.before.length;\n if (name === \"insensitive\") {\n return this.insensitive ? count : -1;\n }\n return -1;\n };\n _proto.toString = function toString() {\n var _this2 = this;\n var selector = [this.rawSpaceBefore, '['];\n selector.push(this._stringFor('qualifiedAttribute', 'attribute'));\n if (this.operator && (this.value || this.value === '')) {\n selector.push(this._stringFor('operator'));\n selector.push(this._stringFor('value'));\n selector.push(this._stringFor('insensitiveFlag', 'insensitive', function (attrValue, attrSpaces) {\n if (attrValue.length > 0 && !_this2.quoted && attrSpaces.before.length === 0 && !(_this2.spaces.value && _this2.spaces.value.after)) {\n attrSpaces.before = \" \";\n }\n return defaultAttrConcat(attrValue, attrSpaces);\n }));\n }\n selector.push(']');\n selector.push(this.rawSpaceAfter);\n return selector.join('');\n };\n _createClass(Attribute, [{\n key: \"quoted\",\n get: function get() {\n var qm = this.quoteMark;\n return qm === \"'\" || qm === '\"';\n },\n set: function set(value) {\n warnOfDeprecatedQuotedAssignment();\n }\n\n /**\n * returns a single (`'`) or double (`\"`) quote character if the value is quoted.\n * returns `null` if the value is not quoted.\n * returns `undefined` if the quotation state is unknown (this can happen when\n * the attribute is constructed without specifying a quote mark.)\n */\n }, {\n key: \"quoteMark\",\n get: function get() {\n return this._quoteMark;\n }\n\n /**\n * Set the quote mark to be used by this attribute's value.\n * If the quote mark changes, the raw (escaped) value at `attr.raws.value` of the attribute\n * value is updated accordingly.\n *\n * @param {\"'\" | '\"' | null} quoteMark The quote mark or `null` if the value should be unquoted.\n */,\n set: function set(quoteMark) {\n if (!this._constructed) {\n this._quoteMark = quoteMark;\n return;\n }\n if (this._quoteMark !== quoteMark) {\n this._quoteMark = quoteMark;\n this._syncRawValue();\n }\n }\n }, {\n key: \"qualifiedAttribute\",\n get: function get() {\n return this.qualifiedName(this.raws.attribute || this.attribute);\n }\n }, {\n key: \"insensitiveFlag\",\n get: function get() {\n return this.insensitive ? 'i' : '';\n }\n }, {\n key: \"value\",\n get: function get() {\n return this._value;\n },\n set:\n /**\n * Before 3.0, the value had to be set to an escaped value including any wrapped\n * quote marks. In 3.0, the semantics of `Attribute.value` changed so that the value\n * is unescaped during parsing and any quote marks are removed.\n *\n * Because the ambiguity of this semantic change, if you set `attr.value = newValue`,\n * a deprecation warning is raised when the new value contains any characters that would\n * require escaping (including if it contains wrapped quotes).\n *\n * Instead, you should call `attr.setValue(newValue, opts)` and pass options that describe\n * how the new value is quoted.\n */\n function set(v) {\n if (this._constructed) {\n var _unescapeValue2 = unescapeValue(v),\n deprecatedUsage = _unescapeValue2.deprecatedUsage,\n unescaped = _unescapeValue2.unescaped,\n quoteMark = _unescapeValue2.quoteMark;\n if (deprecatedUsage) {\n warnOfDeprecatedValueAssignment();\n }\n if (unescaped === this._value && quoteMark === this._quoteMark) {\n return;\n }\n this._value = unescaped;\n this._quoteMark = quoteMark;\n this._syncRawValue();\n } else {\n this._value = v;\n }\n }\n }, {\n key: \"insensitive\",\n get: function get() {\n return this._insensitive;\n }\n\n /**\n * Set the case insensitive flag.\n * If the case insensitive flag changes, the raw (escaped) value at `attr.raws.insensitiveFlag`\n * of the attribute is updated accordingly.\n *\n * @param {true | false} insensitive true if the attribute should match case-insensitively.\n */,\n set: function set(insensitive) {\n if (!insensitive) {\n this._insensitive = false;\n\n // \"i\" and \"I\" can be used in \"this.raws.insensitiveFlag\" to store the original notation.\n // When setting `attr.insensitive = false` both should be erased to ensure correct serialization.\n if (this.raws && (this.raws.insensitiveFlag === 'I' || this.raws.insensitiveFlag === 'i')) {\n this.raws.insensitiveFlag = undefined;\n }\n }\n this._insensitive = insensitive;\n }\n }, {\n key: \"attribute\",\n get: function get() {\n return this._attribute;\n },\n set: function set(name) {\n this._handleEscapes(\"attribute\", name);\n this._attribute = name;\n }\n }]);\n return Attribute;\n}(_namespace[\"default\"]);\nexports[\"default\"] = Attribute;\nAttribute.NO_QUOTE = null;\nAttribute.SINGLE_QUOTE = \"'\";\nAttribute.DOUBLE_QUOTE = '\"';\nvar CSSESC_QUOTE_OPTIONS = (_CSSESC_QUOTE_OPTIONS = {\n \"'\": {\n quotes: 'single',\n wrap: true\n },\n '\"': {\n quotes: 'double',\n wrap: true\n }\n}, _CSSESC_QUOTE_OPTIONS[null] = {\n isIdentifier: true\n}, _CSSESC_QUOTE_OPTIONS);\nfunction defaultAttrConcat(attrValue, attrSpaces) {\n return \"\" + attrSpaces.before + attrValue + attrSpaces.after;\n}", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\nvar _namespace = _interopRequireDefault(require(\"./namespace\"));\nvar _types = require(\"./types\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nvar Universal = /*#__PURE__*/function (_Namespace) {\n _inheritsLoose(Universal, _Namespace);\n function Universal(opts) {\n var _this;\n _this = _Namespace.call(this, opts) || this;\n _this.type = _types.UNIVERSAL;\n _this.value = '*';\n return _this;\n }\n return Universal;\n}(_namespace[\"default\"]);\nexports[\"default\"] = Universal;\nmodule.exports = exports.default;", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\nvar _node = _interopRequireDefault(require(\"./node\"));\nvar _types = require(\"./types\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nvar Combinator = /*#__PURE__*/function (_Node) {\n _inheritsLoose(Combinator, _Node);\n function Combinator(opts) {\n var _this;\n _this = _Node.call(this, opts) || this;\n _this.type = _types.COMBINATOR;\n return _this;\n }\n return Combinator;\n}(_node[\"default\"]);\nexports[\"default\"] = Combinator;\nmodule.exports = exports.default;", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\nvar _node = _interopRequireDefault(require(\"./node\"));\nvar _types = require(\"./types\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nvar Nesting = /*#__PURE__*/function (_Node) {\n _inheritsLoose(Nesting, _Node);\n function Nesting(opts) {\n var _this;\n _this = _Node.call(this, opts) || this;\n _this.type = _types.NESTING;\n _this.value = '&';\n return _this;\n }\n return Nesting;\n}(_node[\"default\"]);\nexports[\"default\"] = Nesting;\nmodule.exports = exports.default;", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = sortAscending;\nfunction sortAscending(list) {\n return list.sort(function (a, b) {\n return a - b;\n });\n}\n;\nmodule.exports = exports.default;", "\"use strict\";\n\nexports.__esModule = true;\nexports.word = exports.tilde = exports.tab = exports.str = exports.space = exports.slash = exports.singleQuote = exports.semicolon = exports.plus = exports.pipe = exports.openSquare = exports.openParenthesis = exports.newline = exports.greaterThan = exports.feed = exports.equals = exports.doubleQuote = exports.dollar = exports.cr = exports.comment = exports.comma = exports.combinator = exports.colon = exports.closeSquare = exports.closeParenthesis = exports.caret = exports.bang = exports.backslash = exports.at = exports.asterisk = exports.ampersand = void 0;\nvar ampersand = 38; // `&`.charCodeAt(0);\nexports.ampersand = ampersand;\nvar asterisk = 42; // `*`.charCodeAt(0);\nexports.asterisk = asterisk;\nvar at = 64; // `@`.charCodeAt(0);\nexports.at = at;\nvar comma = 44; // `,`.charCodeAt(0);\nexports.comma = comma;\nvar colon = 58; // `:`.charCodeAt(0);\nexports.colon = colon;\nvar semicolon = 59; // `;`.charCodeAt(0);\nexports.semicolon = semicolon;\nvar openParenthesis = 40; // `(`.charCodeAt(0);\nexports.openParenthesis = openParenthesis;\nvar closeParenthesis = 41; // `)`.charCodeAt(0);\nexports.closeParenthesis = closeParenthesis;\nvar openSquare = 91; // `[`.charCodeAt(0);\nexports.openSquare = openSquare;\nvar closeSquare = 93; // `]`.charCodeAt(0);\nexports.closeSquare = closeSquare;\nvar dollar = 36; // `$`.charCodeAt(0);\nexports.dollar = dollar;\nvar tilde = 126; // `~`.charCodeAt(0);\nexports.tilde = tilde;\nvar caret = 94; // `^`.charCodeAt(0);\nexports.caret = caret;\nvar plus = 43; // `+`.charCodeAt(0);\nexports.plus = plus;\nvar equals = 61; // `=`.charCodeAt(0);\nexports.equals = equals;\nvar pipe = 124; // `|`.charCodeAt(0);\nexports.pipe = pipe;\nvar greaterThan = 62; // `>`.charCodeAt(0);\nexports.greaterThan = greaterThan;\nvar space = 32; // ` `.charCodeAt(0);\nexports.space = space;\nvar singleQuote = 39; // `'`.charCodeAt(0);\nexports.singleQuote = singleQuote;\nvar doubleQuote = 34; // `\"`.charCodeAt(0);\nexports.doubleQuote = doubleQuote;\nvar slash = 47; // `/`.charCodeAt(0);\nexports.slash = slash;\nvar bang = 33; // `!`.charCodeAt(0);\nexports.bang = bang;\nvar backslash = 92; // '\\\\'.charCodeAt(0);\nexports.backslash = backslash;\nvar cr = 13; // '\\r'.charCodeAt(0);\nexports.cr = cr;\nvar feed = 12; // '\\f'.charCodeAt(0);\nexports.feed = feed;\nvar newline = 10; // '\\n'.charCodeAt(0);\nexports.newline = newline;\nvar tab = 9; // '\\t'.charCodeAt(0);\n\n// Expose aliases primarily for readability.\nexports.tab = tab;\nvar str = singleQuote;\n\n// No good single character representation!\nexports.str = str;\nvar comment = -1;\nexports.comment = comment;\nvar word = -2;\nexports.word = word;\nvar combinator = -3;\nexports.combinator = combinator;", "\"use strict\";\n\nexports.__esModule = true;\nexports.FIELDS = void 0;\nexports[\"default\"] = tokenize;\nvar t = _interopRequireWildcard(require(\"./tokenTypes\"));\nvar _unescapable, _wordDelimiters;\nfunction _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== \"function\") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }\nfunction _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== \"object\" && typeof obj !== \"function\") { return { \"default\": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj[\"default\"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }\nvar unescapable = (_unescapable = {}, _unescapable[t.tab] = true, _unescapable[t.newline] = true, _unescapable[t.cr] = true, _unescapable[t.feed] = true, _unescapable);\nvar wordDelimiters = (_wordDelimiters = {}, _wordDelimiters[t.space] = true, _wordDelimiters[t.tab] = true, _wordDelimiters[t.newline] = true, _wordDelimiters[t.cr] = true, _wordDelimiters[t.feed] = true, _wordDelimiters[t.ampersand] = true, _wordDelimiters[t.asterisk] = true, _wordDelimiters[t.bang] = true, _wordDelimiters[t.comma] = true, _wordDelimiters[t.colon] = true, _wordDelimiters[t.semicolon] = true, _wordDelimiters[t.openParenthesis] = true, _wordDelimiters[t.closeParenthesis] = true, _wordDelimiters[t.openSquare] = true, _wordDelimiters[t.closeSquare] = true, _wordDelimiters[t.singleQuote] = true, _wordDelimiters[t.doubleQuote] = true, _wordDelimiters[t.plus] = true, _wordDelimiters[t.pipe] = true, _wordDelimiters[t.tilde] = true, _wordDelimiters[t.greaterThan] = true, _wordDelimiters[t.equals] = true, _wordDelimiters[t.dollar] = true, _wordDelimiters[t.caret] = true, _wordDelimiters[t.slash] = true, _wordDelimiters);\nvar hex = {};\nvar hexChars = \"0123456789abcdefABCDEF\";\nfor (var i = 0; i < hexChars.length; i++) {\n hex[hexChars.charCodeAt(i)] = true;\n}\n\n/**\n * Returns the last index of the bar css word\n * @param {string} css The string in which the word begins\n * @param {number} start The index into the string where word's first letter occurs\n */\nfunction consumeWord(css, start) {\n var next = start;\n var code;\n do {\n code = css.charCodeAt(next);\n if (wordDelimiters[code]) {\n return next - 1;\n } else if (code === t.backslash) {\n next = consumeEscape(css, next) + 1;\n } else {\n // All other characters are part of the word\n next++;\n }\n } while (next < css.length);\n return next - 1;\n}\n\n/**\n * Returns the last index of the escape sequence\n * @param {string} css The string in which the sequence begins\n * @param {number} start The index into the string where escape character (`\\`) occurs.\n */\nfunction consumeEscape(css, start) {\n var next = start;\n var code = css.charCodeAt(next + 1);\n if (unescapable[code]) {\n // just consume the escape char\n } else if (hex[code]) {\n var hexDigits = 0;\n // consume up to 6 hex chars\n do {\n next++;\n hexDigits++;\n code = css.charCodeAt(next + 1);\n } while (hex[code] && hexDigits < 6);\n // if fewer than 6 hex chars, a trailing space ends the escape\n if (hexDigits < 6 && code === t.space) {\n next++;\n }\n } else {\n // the next char is part of the current word\n next++;\n }\n return next;\n}\nvar FIELDS = {\n TYPE: 0,\n START_LINE: 1,\n START_COL: 2,\n END_LINE: 3,\n END_COL: 4,\n START_POS: 5,\n END_POS: 6\n};\nexports.FIELDS = FIELDS;\nfunction tokenize(input) {\n var tokens = [];\n var css = input.css.valueOf();\n var _css = css,\n length = _css.length;\n var offset = -1;\n var line = 1;\n var start = 0;\n var end = 0;\n var code, content, endColumn, endLine, escaped, escapePos, last, lines, next, nextLine, nextOffset, quote, tokenType;\n function unclosed(what, fix) {\n if (input.safe) {\n // fyi: this is never set to true.\n css += fix;\n next = css.length - 1;\n } else {\n throw input.error('Unclosed ' + what, line, start - offset, start);\n }\n }\n while (start < length) {\n code = css.charCodeAt(start);\n if (code === t.newline) {\n offset = start;\n line += 1;\n }\n switch (code) {\n case t.space:\n case t.tab:\n case t.newline:\n case t.cr:\n case t.feed:\n next = start;\n do {\n next += 1;\n code = css.charCodeAt(next);\n if (code === t.newline) {\n offset = next;\n line += 1;\n }\n } while (code === t.space || code === t.newline || code === t.tab || code === t.cr || code === t.feed);\n tokenType = t.space;\n endLine = line;\n endColumn = next - offset - 1;\n end = next;\n break;\n case t.plus:\n case t.greaterThan:\n case t.tilde:\n case t.pipe:\n next = start;\n do {\n next += 1;\n code = css.charCodeAt(next);\n } while (code === t.plus || code === t.greaterThan || code === t.tilde || code === t.pipe);\n tokenType = t.combinator;\n endLine = line;\n endColumn = start - offset;\n end = next;\n break;\n\n // Consume these characters as single tokens.\n case t.asterisk:\n case t.ampersand:\n case t.bang:\n case t.comma:\n case t.equals:\n case t.dollar:\n case t.caret:\n case t.openSquare:\n case t.closeSquare:\n case t.colon:\n case t.semicolon:\n case t.openParenthesis:\n case t.closeParenthesis:\n next = start;\n tokenType = code;\n endLine = line;\n endColumn = start - offset;\n end = next + 1;\n break;\n case t.singleQuote:\n case t.doubleQuote:\n quote = code === t.singleQuote ? \"'\" : '\"';\n next = start;\n do {\n escaped = false;\n next = css.indexOf(quote, next + 1);\n if (next === -1) {\n unclosed('quote', quote);\n }\n escapePos = next;\n while (css.charCodeAt(escapePos - 1) === t.backslash) {\n escapePos -= 1;\n escaped = !escaped;\n }\n } while (escaped);\n tokenType = t.str;\n endLine = line;\n endColumn = start - offset;\n end = next + 1;\n break;\n default:\n if (code === t.slash && css.charCodeAt(start + 1) === t.asterisk) {\n next = css.indexOf('*/', start + 2) + 1;\n if (next === 0) {\n unclosed('comment', '*/');\n }\n content = css.slice(start, next + 1);\n lines = content.split('\\n');\n last = lines.length - 1;\n if (last > 0) {\n nextLine = line + last;\n nextOffset = next - lines[last].length;\n } else {\n nextLine = line;\n nextOffset = offset;\n }\n tokenType = t.comment;\n line = nextLine;\n endLine = nextLine;\n endColumn = next - nextOffset;\n } else if (code === t.slash) {\n next = start;\n tokenType = code;\n endLine = line;\n endColumn = start - offset;\n end = next + 1;\n } else {\n next = consumeWord(css, start);\n tokenType = t.word;\n endLine = line;\n endColumn = next - offset;\n }\n end = next + 1;\n break;\n }\n\n // Ensure that the token structure remains consistent\n tokens.push([tokenType,\n // [0] Token type\n line,\n // [1] Starting line\n start - offset,\n // [2] Starting column\n endLine,\n // [3] Ending line\n endColumn,\n // [4] Ending column\n start,\n // [5] Start position / Source index\n end // [6] End position\n ]);\n\n // Reset offset for the next token\n if (nextOffset) {\n offset = nextOffset;\n nextOffset = null;\n }\n start = end;\n }\n return tokens;\n}", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\nvar _root = _interopRequireDefault(require(\"./selectors/root\"));\nvar _selector = _interopRequireDefault(require(\"./selectors/selector\"));\nvar _className = _interopRequireDefault(require(\"./selectors/className\"));\nvar _comment = _interopRequireDefault(require(\"./selectors/comment\"));\nvar _id = _interopRequireDefault(require(\"./selectors/id\"));\nvar _tag = _interopRequireDefault(require(\"./selectors/tag\"));\nvar _string = _interopRequireDefault(require(\"./selectors/string\"));\nvar _pseudo = _interopRequireDefault(require(\"./selectors/pseudo\"));\nvar _attribute = _interopRequireWildcard(require(\"./selectors/attribute\"));\nvar _universal = _interopRequireDefault(require(\"./selectors/universal\"));\nvar _combinator = _interopRequireDefault(require(\"./selectors/combinator\"));\nvar _nesting = _interopRequireDefault(require(\"./selectors/nesting\"));\nvar _sortAscending = _interopRequireDefault(require(\"./sortAscending\"));\nvar _tokenize = _interopRequireWildcard(require(\"./tokenize\"));\nvar tokens = _interopRequireWildcard(require(\"./tokenTypes\"));\nvar types = _interopRequireWildcard(require(\"./selectors/types\"));\nvar _util = require(\"./util\");\nvar _WHITESPACE_TOKENS, _Object$assign;\nfunction _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== \"function\") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }\nfunction _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== \"object\" && typeof obj !== \"function\") { return { \"default\": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj[\"default\"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nvar WHITESPACE_TOKENS = (_WHITESPACE_TOKENS = {}, _WHITESPACE_TOKENS[tokens.space] = true, _WHITESPACE_TOKENS[tokens.cr] = true, _WHITESPACE_TOKENS[tokens.feed] = true, _WHITESPACE_TOKENS[tokens.newline] = true, _WHITESPACE_TOKENS[tokens.tab] = true, _WHITESPACE_TOKENS);\nvar WHITESPACE_EQUIV_TOKENS = Object.assign({}, WHITESPACE_TOKENS, (_Object$assign = {}, _Object$assign[tokens.comment] = true, _Object$assign));\nfunction tokenStart(token) {\n return {\n line: token[_tokenize.FIELDS.START_LINE],\n column: token[_tokenize.FIELDS.START_COL]\n };\n}\nfunction tokenEnd(token) {\n return {\n line: token[_tokenize.FIELDS.END_LINE],\n column: token[_tokenize.FIELDS.END_COL]\n };\n}\nfunction getSource(startLine, startColumn, endLine, endColumn) {\n return {\n start: {\n line: startLine,\n column: startColumn\n },\n end: {\n line: endLine,\n column: endColumn\n }\n };\n}\nfunction getTokenSource(token) {\n return getSource(token[_tokenize.FIELDS.START_LINE], token[_tokenize.FIELDS.START_COL], token[_tokenize.FIELDS.END_LINE], token[_tokenize.FIELDS.END_COL]);\n}\nfunction getTokenSourceSpan(startToken, endToken) {\n if (!startToken) {\n return undefined;\n }\n return getSource(startToken[_tokenize.FIELDS.START_LINE], startToken[_tokenize.FIELDS.START_COL], endToken[_tokenize.FIELDS.END_LINE], endToken[_tokenize.FIELDS.END_COL]);\n}\nfunction unescapeProp(node, prop) {\n var value = node[prop];\n if (typeof value !== \"string\") {\n return;\n }\n if (value.indexOf(\"\\\\\") !== -1) {\n (0, _util.ensureObject)(node, 'raws');\n node[prop] = (0, _util.unesc)(value);\n if (node.raws[prop] === undefined) {\n node.raws[prop] = value;\n }\n }\n return node;\n}\nfunction indexesOf(array, item) {\n var i = -1;\n var indexes = [];\n while ((i = array.indexOf(item, i + 1)) !== -1) {\n indexes.push(i);\n }\n return indexes;\n}\nfunction uniqs() {\n var list = Array.prototype.concat.apply([], arguments);\n return list.filter(function (item, i) {\n return i === list.indexOf(item);\n });\n}\nvar Parser = /*#__PURE__*/function () {\n function Parser(rule, options) {\n if (options === void 0) {\n options = {};\n }\n this.rule = rule;\n this.options = Object.assign({\n lossy: false,\n safe: false\n }, options);\n this.position = 0;\n this.css = typeof this.rule === 'string' ? this.rule : this.rule.selector;\n this.tokens = (0, _tokenize[\"default\"])({\n css: this.css,\n error: this._errorGenerator(),\n safe: this.options.safe\n });\n var rootSource = getTokenSourceSpan(this.tokens[0], this.tokens[this.tokens.length - 1]);\n this.root = new _root[\"default\"]({\n source: rootSource\n });\n this.root.errorGenerator = this._errorGenerator();\n var selector = new _selector[\"default\"]({\n source: {\n start: {\n line: 1,\n column: 1\n }\n },\n sourceIndex: 0\n });\n this.root.append(selector);\n this.current = selector;\n this.loop();\n }\n var _proto = Parser.prototype;\n _proto._errorGenerator = function _errorGenerator() {\n var _this = this;\n return function (message, errorOptions) {\n if (typeof _this.rule === 'string') {\n return new Error(message);\n }\n return _this.rule.error(message, errorOptions);\n };\n };\n _proto.attribute = function attribute() {\n var attr = [];\n var startingToken = this.currToken;\n this.position++;\n while (this.position < this.tokens.length && this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {\n attr.push(this.currToken);\n this.position++;\n }\n if (this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {\n return this.expected('closing square bracket', this.currToken[_tokenize.FIELDS.START_POS]);\n }\n var len = attr.length;\n var node = {\n source: getSource(startingToken[1], startingToken[2], this.currToken[3], this.currToken[4]),\n sourceIndex: startingToken[_tokenize.FIELDS.START_POS]\n };\n if (len === 1 && !~[tokens.word].indexOf(attr[0][_tokenize.FIELDS.TYPE])) {\n return this.expected('attribute', attr[0][_tokenize.FIELDS.START_POS]);\n }\n var pos = 0;\n var spaceBefore = '';\n var commentBefore = '';\n var lastAdded = null;\n var spaceAfterMeaningfulToken = false;\n while (pos < len) {\n var token = attr[pos];\n var content = this.content(token);\n var next = attr[pos + 1];\n switch (token[_tokenize.FIELDS.TYPE]) {\n case tokens.space:\n // if (\n // len === 1 ||\n // pos === 0 && this.content(next) === '|'\n // ) {\n // return this.expected('attribute', token[TOKEN.START_POS], content);\n // }\n spaceAfterMeaningfulToken = true;\n if (this.options.lossy) {\n break;\n }\n if (lastAdded) {\n (0, _util.ensureObject)(node, 'spaces', lastAdded);\n var prevContent = node.spaces[lastAdded].after || '';\n node.spaces[lastAdded].after = prevContent + content;\n var existingComment = (0, _util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || null;\n if (existingComment) {\n node.raws.spaces[lastAdded].after = existingComment + content;\n }\n } else {\n spaceBefore = spaceBefore + content;\n commentBefore = commentBefore + content;\n }\n break;\n case tokens.asterisk:\n if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {\n node.operator = content;\n lastAdded = 'operator';\n } else if ((!node.namespace || lastAdded === \"namespace\" && !spaceAfterMeaningfulToken) && next) {\n if (spaceBefore) {\n (0, _util.ensureObject)(node, 'spaces', 'attribute');\n node.spaces.attribute.before = spaceBefore;\n spaceBefore = '';\n }\n if (commentBefore) {\n (0, _util.ensureObject)(node, 'raws', 'spaces', 'attribute');\n node.raws.spaces.attribute.before = spaceBefore;\n commentBefore = '';\n }\n node.namespace = (node.namespace || \"\") + content;\n var rawValue = (0, _util.getProp)(node, 'raws', 'namespace') || null;\n if (rawValue) {\n node.raws.namespace += content;\n }\n lastAdded = 'namespace';\n }\n spaceAfterMeaningfulToken = false;\n break;\n case tokens.dollar:\n if (lastAdded === \"value\") {\n var oldRawValue = (0, _util.getProp)(node, 'raws', 'value');\n node.value += \"$\";\n if (oldRawValue) {\n node.raws.value = oldRawValue + \"$\";\n }\n break;\n }\n // Falls through\n case tokens.caret:\n if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {\n node.operator = content;\n lastAdded = 'operator';\n }\n spaceAfterMeaningfulToken = false;\n break;\n case tokens.combinator:\n if (content === '~' && next[_tokenize.FIELDS.TYPE] === tokens.equals) {\n node.operator = content;\n lastAdded = 'operator';\n }\n if (content !== '|') {\n spaceAfterMeaningfulToken = false;\n break;\n }\n if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {\n node.operator = content;\n lastAdded = 'operator';\n } else if (!node.namespace && !node.attribute) {\n node.namespace = true;\n }\n spaceAfterMeaningfulToken = false;\n break;\n case tokens.word:\n if (next && this.content(next) === '|' && attr[pos + 2] && attr[pos + 2][_tokenize.FIELDS.TYPE] !== tokens.equals &&\n // this look-ahead probably fails with comment nodes involved.\n !node.operator && !node.namespace) {\n node.namespace = content;\n lastAdded = 'namespace';\n } else if (!node.attribute || lastAdded === \"attribute\" && !spaceAfterMeaningfulToken) {\n if (spaceBefore) {\n (0, _util.ensureObject)(node, 'spaces', 'attribute');\n node.spaces.attribute.before = spaceBefore;\n spaceBefore = '';\n }\n if (commentBefore) {\n (0, _util.ensureObject)(node, 'raws', 'spaces', 'attribute');\n node.raws.spaces.attribute.before = commentBefore;\n commentBefore = '';\n }\n node.attribute = (node.attribute || \"\") + content;\n var _rawValue = (0, _util.getProp)(node, 'raws', 'attribute') || null;\n if (_rawValue) {\n node.raws.attribute += content;\n }\n lastAdded = 'attribute';\n } else if (!node.value && node.value !== \"\" || lastAdded === \"value\" && !(spaceAfterMeaningfulToken || node.quoteMark)) {\n var _unescaped = (0, _util.unesc)(content);\n var _oldRawValue = (0, _util.getProp)(node, 'raws', 'value') || '';\n var oldValue = node.value || '';\n node.value = oldValue + _unescaped;\n node.quoteMark = null;\n if (_unescaped !== content || _oldRawValue) {\n (0, _util.ensureObject)(node, 'raws');\n node.raws.value = (_oldRawValue || oldValue) + content;\n }\n lastAdded = 'value';\n } else {\n var insensitive = content === 'i' || content === \"I\";\n if ((node.value || node.value === '') && (node.quoteMark || spaceAfterMeaningfulToken)) {\n node.insensitive = insensitive;\n if (!insensitive || content === \"I\") {\n (0, _util.ensureObject)(node, 'raws');\n node.raws.insensitiveFlag = content;\n }\n lastAdded = 'insensitive';\n if (spaceBefore) {\n (0, _util.ensureObject)(node, 'spaces', 'insensitive');\n node.spaces.insensitive.before = spaceBefore;\n spaceBefore = '';\n }\n if (commentBefore) {\n (0, _util.ensureObject)(node, 'raws', 'spaces', 'insensitive');\n node.raws.spaces.insensitive.before = commentBefore;\n commentBefore = '';\n }\n } else if (node.value || node.value === '') {\n lastAdded = 'value';\n node.value += content;\n if (node.raws.value) {\n node.raws.value += content;\n }\n }\n }\n spaceAfterMeaningfulToken = false;\n break;\n case tokens.str:\n if (!node.attribute || !node.operator) {\n return this.error(\"Expected an attribute followed by an operator preceding the string.\", {\n index: token[_tokenize.FIELDS.START_POS]\n });\n }\n var _unescapeValue = (0, _attribute.unescapeValue)(content),\n unescaped = _unescapeValue.unescaped,\n quoteMark = _unescapeValue.quoteMark;\n node.value = unescaped;\n node.quoteMark = quoteMark;\n lastAdded = 'value';\n (0, _util.ensureObject)(node, 'raws');\n node.raws.value = content;\n spaceAfterMeaningfulToken = false;\n break;\n case tokens.equals:\n if (!node.attribute) {\n return this.expected('attribute', token[_tokenize.FIELDS.START_POS], content);\n }\n if (node.value) {\n return this.error('Unexpected \"=\" found; an operator was already defined.', {\n index: token[_tokenize.FIELDS.START_POS]\n });\n }\n node.operator = node.operator ? node.operator + content : content;\n lastAdded = 'operator';\n spaceAfterMeaningfulToken = false;\n break;\n case tokens.comment:\n if (lastAdded) {\n if (spaceAfterMeaningfulToken || next && next[_tokenize.FIELDS.TYPE] === tokens.space || lastAdded === 'insensitive') {\n var lastComment = (0, _util.getProp)(node, 'spaces', lastAdded, 'after') || '';\n var rawLastComment = (0, _util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || lastComment;\n (0, _util.ensureObject)(node, 'raws', 'spaces', lastAdded);\n node.raws.spaces[lastAdded].after = rawLastComment + content;\n } else {\n var lastValue = node[lastAdded] || '';\n var rawLastValue = (0, _util.getProp)(node, 'raws', lastAdded) || lastValue;\n (0, _util.ensureObject)(node, 'raws');\n node.raws[lastAdded] = rawLastValue + content;\n }\n } else {\n commentBefore = commentBefore + content;\n }\n break;\n default:\n return this.error(\"Unexpected \\\"\" + content + \"\\\" found.\", {\n index: token[_tokenize.FIELDS.START_POS]\n });\n }\n pos++;\n }\n unescapeProp(node, \"attribute\");\n unescapeProp(node, \"namespace\");\n this.newNode(new _attribute[\"default\"](node));\n this.position++;\n }\n\n /**\n * return a node containing meaningless garbage up to (but not including) the specified token position.\n * if the token position is negative, all remaining tokens are consumed.\n *\n * This returns an array containing a single string node if all whitespace,\n * otherwise an array of comment nodes with space before and after.\n *\n * These tokens are not added to the current selector, the caller can add them or use them to amend\n * a previous node's space metadata.\n *\n * In lossy mode, this returns only comments.\n */;\n _proto.parseWhitespaceEquivalentTokens = function parseWhitespaceEquivalentTokens(stopPosition) {\n if (stopPosition < 0) {\n stopPosition = this.tokens.length;\n }\n var startPosition = this.position;\n var nodes = [];\n var space = \"\";\n var lastComment = undefined;\n do {\n if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) {\n if (!this.options.lossy) {\n space += this.content();\n }\n } else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.comment) {\n var spaces = {};\n if (space) {\n spaces.before = space;\n space = \"\";\n }\n lastComment = new _comment[\"default\"]({\n value: this.content(),\n source: getTokenSource(this.currToken),\n sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],\n spaces: spaces\n });\n nodes.push(lastComment);\n }\n } while (++this.position < stopPosition);\n if (space) {\n if (lastComment) {\n lastComment.spaces.after = space;\n } else if (!this.options.lossy) {\n var firstToken = this.tokens[startPosition];\n var lastToken = this.tokens[this.position - 1];\n nodes.push(new _string[\"default\"]({\n value: '',\n source: getSource(firstToken[_tokenize.FIELDS.START_LINE], firstToken[_tokenize.FIELDS.START_COL], lastToken[_tokenize.FIELDS.END_LINE], lastToken[_tokenize.FIELDS.END_COL]),\n sourceIndex: firstToken[_tokenize.FIELDS.START_POS],\n spaces: {\n before: space,\n after: ''\n }\n }));\n }\n }\n return nodes;\n }\n\n /**\n *\n * @param {*} nodes\n */;\n _proto.convertWhitespaceNodesToSpace = function convertWhitespaceNodesToSpace(nodes, requiredSpace) {\n var _this2 = this;\n if (requiredSpace === void 0) {\n requiredSpace = false;\n }\n var space = \"\";\n var rawSpace = \"\";\n nodes.forEach(function (n) {\n var spaceBefore = _this2.lossySpace(n.spaces.before, requiredSpace);\n var rawSpaceBefore = _this2.lossySpace(n.rawSpaceBefore, requiredSpace);\n space += spaceBefore + _this2.lossySpace(n.spaces.after, requiredSpace && spaceBefore.length === 0);\n rawSpace += spaceBefore + n.value + _this2.lossySpace(n.rawSpaceAfter, requiredSpace && rawSpaceBefore.length === 0);\n });\n if (rawSpace === space) {\n rawSpace = undefined;\n }\n var result = {\n space: space,\n rawSpace: rawSpace\n };\n return result;\n };\n _proto.isNamedCombinator = function isNamedCombinator(position) {\n if (position === void 0) {\n position = this.position;\n }\n return this.tokens[position + 0] && this.tokens[position + 0][_tokenize.FIELDS.TYPE] === tokens.slash && this.tokens[position + 1] && this.tokens[position + 1][_tokenize.FIELDS.TYPE] === tokens.word && this.tokens[position + 2] && this.tokens[position + 2][_tokenize.FIELDS.TYPE] === tokens.slash;\n };\n _proto.namedCombinator = function namedCombinator() {\n if (this.isNamedCombinator()) {\n var nameRaw = this.content(this.tokens[this.position + 1]);\n var name = (0, _util.unesc)(nameRaw).toLowerCase();\n var raws = {};\n if (name !== nameRaw) {\n raws.value = \"/\" + nameRaw + \"/\";\n }\n var node = new _combinator[\"default\"]({\n value: \"/\" + name + \"/\",\n source: getSource(this.currToken[_tokenize.FIELDS.START_LINE], this.currToken[_tokenize.FIELDS.START_COL], this.tokens[this.position + 2][_tokenize.FIELDS.END_LINE], this.tokens[this.position + 2][_tokenize.FIELDS.END_COL]),\n sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],\n raws: raws\n });\n this.position = this.position + 3;\n return node;\n } else {\n this.unexpected();\n }\n };\n _proto.combinator = function combinator() {\n var _this3 = this;\n if (this.content() === '|') {\n return this.namespace();\n }\n // We need to decide between a space that's a descendant combinator and meaningless whitespace at the end of a selector.\n var nextSigTokenPos = this.locateNextMeaningfulToken(this.position);\n if (nextSigTokenPos < 0 || this.tokens[nextSigTokenPos][_tokenize.FIELDS.TYPE] === tokens.comma || this.tokens[nextSigTokenPos][_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {\n var nodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);\n if (nodes.length > 0) {\n var last = this.current.last;\n if (last) {\n var _this$convertWhitespa = this.convertWhitespaceNodesToSpace(nodes),\n space = _this$convertWhitespa.space,\n rawSpace = _this$convertWhitespa.rawSpace;\n if (rawSpace !== undefined) {\n last.rawSpaceAfter += rawSpace;\n }\n last.spaces.after += space;\n } else {\n nodes.forEach(function (n) {\n return _this3.newNode(n);\n });\n }\n }\n return;\n }\n var firstToken = this.currToken;\n var spaceOrDescendantSelectorNodes = undefined;\n if (nextSigTokenPos > this.position) {\n spaceOrDescendantSelectorNodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);\n }\n var node;\n if (this.isNamedCombinator()) {\n node = this.namedCombinator();\n } else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.combinator) {\n node = new _combinator[\"default\"]({\n value: this.content(),\n source: getTokenSource(this.currToken),\n sourceIndex: this.currToken[_tokenize.FIELDS.START_POS]\n });\n this.position++;\n } else if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) {\n // pass\n } else if (!spaceOrDescendantSelectorNodes) {\n this.unexpected();\n }\n if (node) {\n if (spaceOrDescendantSelectorNodes) {\n var _this$convertWhitespa2 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes),\n _space = _this$convertWhitespa2.space,\n _rawSpace = _this$convertWhitespa2.rawSpace;\n node.spaces.before = _space;\n node.rawSpaceBefore = _rawSpace;\n }\n } else {\n // descendant combinator\n var _this$convertWhitespa3 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes, true),\n _space2 = _this$convertWhitespa3.space,\n _rawSpace2 = _this$convertWhitespa3.rawSpace;\n if (!_rawSpace2) {\n _rawSpace2 = _space2;\n }\n var spaces = {};\n var raws = {\n spaces: {}\n };\n if (_space2.endsWith(' ') && _rawSpace2.endsWith(' ')) {\n spaces.before = _space2.slice(0, _space2.length - 1);\n raws.spaces.before = _rawSpace2.slice(0, _rawSpace2.length - 1);\n } else if (_space2[0] === ' ' && _rawSpace2[0] === ' ') {\n spaces.after = _space2.slice(1);\n raws.spaces.after = _rawSpace2.slice(1);\n } else {\n raws.value = _rawSpace2;\n }\n node = new _combinator[\"default\"]({\n value: ' ',\n source: getTokenSourceSpan(firstToken, this.tokens[this.position - 1]),\n sourceIndex: firstToken[_tokenize.FIELDS.START_POS],\n spaces: spaces,\n raws: raws\n });\n }\n if (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.space) {\n node.spaces.after = this.optionalSpace(this.content());\n this.position++;\n }\n return this.newNode(node);\n };\n _proto.comma = function comma() {\n if (this.position === this.tokens.length - 1) {\n this.root.trailingComma = true;\n this.position++;\n return;\n }\n this.current._inferEndPosition();\n var selector = new _selector[\"default\"]({\n source: {\n start: tokenStart(this.tokens[this.position + 1])\n },\n sourceIndex: this.tokens[this.position + 1][_tokenize.FIELDS.START_POS]\n });\n this.current.parent.append(selector);\n this.current = selector;\n this.position++;\n };\n _proto.comment = function comment() {\n var current = this.currToken;\n this.newNode(new _comment[\"default\"]({\n value: this.content(),\n source: getTokenSource(current),\n sourceIndex: current[_tokenize.FIELDS.START_POS]\n }));\n this.position++;\n };\n _proto.error = function error(message, opts) {\n throw this.root.error(message, opts);\n };\n _proto.missingBackslash = function missingBackslash() {\n return this.error('Expected a backslash preceding the semicolon.', {\n index: this.currToken[_tokenize.FIELDS.START_POS]\n });\n };\n _proto.missingParenthesis = function missingParenthesis() {\n return this.expected('opening parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);\n };\n _proto.missingSquareBracket = function missingSquareBracket() {\n return this.expected('opening square bracket', this.currToken[_tokenize.FIELDS.START_POS]);\n };\n _proto.unexpected = function unexpected() {\n return this.error(\"Unexpected '\" + this.content() + \"'. Escaping special characters with \\\\ may help.\", this.currToken[_tokenize.FIELDS.START_POS]);\n };\n _proto.unexpectedPipe = function unexpectedPipe() {\n return this.error(\"Unexpected '|'.\", this.currToken[_tokenize.FIELDS.START_POS]);\n };\n _proto.namespace = function namespace() {\n var before = this.prevToken && this.content(this.prevToken) || true;\n if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.word) {\n this.position++;\n return this.word(before);\n } else if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.asterisk) {\n this.position++;\n return this.universal(before);\n }\n this.unexpectedPipe();\n };\n _proto.nesting = function nesting() {\n if (this.nextToken) {\n var nextContent = this.content(this.nextToken);\n if (nextContent === \"|\") {\n this.position++;\n return;\n }\n }\n var current = this.currToken;\n this.newNode(new _nesting[\"default\"]({\n value: this.content(),\n source: getTokenSource(current),\n sourceIndex: current[_tokenize.FIELDS.START_POS]\n }));\n this.position++;\n };\n _proto.parentheses = function parentheses() {\n var last = this.current.last;\n var unbalanced = 1;\n this.position++;\n if (last && last.type === types.PSEUDO) {\n var selector = new _selector[\"default\"]({\n source: {\n start: tokenStart(this.tokens[this.position])\n },\n sourceIndex: this.tokens[this.position][_tokenize.FIELDS.START_POS]\n });\n var cache = this.current;\n last.append(selector);\n this.current = selector;\n while (this.position < this.tokens.length && unbalanced) {\n if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {\n unbalanced++;\n }\n if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {\n unbalanced--;\n }\n if (unbalanced) {\n this.parse();\n } else {\n this.current.source.end = tokenEnd(this.currToken);\n this.current.parent.source.end = tokenEnd(this.currToken);\n this.position++;\n }\n }\n this.current = cache;\n } else {\n // I think this case should be an error. It's used to implement a basic parse of media queries\n // but I don't think it's a good idea.\n var parenStart = this.currToken;\n var parenValue = \"(\";\n var parenEnd;\n while (this.position < this.tokens.length && unbalanced) {\n if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {\n unbalanced++;\n }\n if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {\n unbalanced--;\n }\n parenEnd = this.currToken;\n parenValue += this.parseParenthesisToken(this.currToken);\n this.position++;\n }\n if (last) {\n last.appendToPropertyAndEscape(\"value\", parenValue, parenValue);\n } else {\n this.newNode(new _string[\"default\"]({\n value: parenValue,\n source: getSource(parenStart[_tokenize.FIELDS.START_LINE], parenStart[_tokenize.FIELDS.START_COL], parenEnd[_tokenize.FIELDS.END_LINE], parenEnd[_tokenize.FIELDS.END_COL]),\n sourceIndex: parenStart[_tokenize.FIELDS.START_POS]\n }));\n }\n }\n if (unbalanced) {\n return this.expected('closing parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);\n }\n };\n _proto.pseudo = function pseudo() {\n var _this4 = this;\n var pseudoStr = '';\n var startingToken = this.currToken;\n while (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.colon) {\n pseudoStr += this.content();\n this.position++;\n }\n if (!this.currToken) {\n return this.expected(['pseudo-class', 'pseudo-element'], this.position - 1);\n }\n if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.word) {\n this.splitWord(false, function (first, length) {\n pseudoStr += first;\n _this4.newNode(new _pseudo[\"default\"]({\n value: pseudoStr,\n source: getTokenSourceSpan(startingToken, _this4.currToken),\n sourceIndex: startingToken[_tokenize.FIELDS.START_POS]\n }));\n if (length > 1 && _this4.nextToken && _this4.nextToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {\n _this4.error('Misplaced parenthesis.', {\n index: _this4.nextToken[_tokenize.FIELDS.START_POS]\n });\n }\n });\n } else {\n return this.expected(['pseudo-class', 'pseudo-element'], this.currToken[_tokenize.FIELDS.START_POS]);\n }\n };\n _proto.space = function space() {\n var content = this.content();\n // Handle space before and after the selector\n if (this.position === 0 || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis || this.current.nodes.every(function (node) {\n return node.type === 'comment';\n })) {\n this.spaces = this.optionalSpace(content);\n this.position++;\n } else if (this.position === this.tokens.length - 1 || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {\n this.current.last.spaces.after = this.optionalSpace(content);\n this.position++;\n } else {\n this.combinator();\n }\n };\n _proto.string = function string() {\n var current = this.currToken;\n this.newNode(new _string[\"default\"]({\n value: this.content(),\n source: getTokenSource(current),\n sourceIndex: current[_tokenize.FIELDS.START_POS]\n }));\n this.position++;\n };\n _proto.universal = function universal(namespace) {\n var nextToken = this.nextToken;\n if (nextToken && this.content(nextToken) === '|') {\n this.position++;\n return this.namespace();\n }\n var current = this.currToken;\n this.newNode(new _universal[\"default\"]({\n value: this.content(),\n source: getTokenSource(current),\n sourceIndex: current[_tokenize.FIELDS.START_POS]\n }), namespace);\n this.position++;\n };\n _proto.splitWord = function splitWord(namespace, firstCallback) {\n var _this5 = this;\n var nextToken = this.nextToken;\n var word = this.content();\n while (nextToken && ~[tokens.dollar, tokens.caret, tokens.equals, tokens.word].indexOf(nextToken[_tokenize.FIELDS.TYPE])) {\n this.position++;\n var current = this.content();\n word += current;\n if (current.lastIndexOf('\\\\') === current.length - 1) {\n var next = this.nextToken;\n if (next && next[_tokenize.FIELDS.TYPE] === tokens.space) {\n word += this.requiredSpace(this.content(next));\n this.position++;\n }\n }\n nextToken = this.nextToken;\n }\n var hasClass = indexesOf(word, '.').filter(function (i) {\n // Allow escaped dot within class name\n var escapedDot = word[i - 1] === '\\\\';\n // Allow decimal numbers percent in @keyframes\n var isKeyframesPercent = /^\\d+\\.\\d+%$/.test(word);\n return !escapedDot && !isKeyframesPercent;\n });\n var hasId = indexesOf(word, '#').filter(function (i) {\n return word[i - 1] !== '\\\\';\n });\n // Eliminate Sass interpolations from the list of id indexes\n var interpolations = indexesOf(word, '#{');\n if (interpolations.length) {\n hasId = hasId.filter(function (hashIndex) {\n return !~interpolations.indexOf(hashIndex);\n });\n }\n var indices = (0, _sortAscending[\"default\"])(uniqs([0].concat(hasClass, hasId)));\n indices.forEach(function (ind, i) {\n var index = indices[i + 1] || word.length;\n var value = word.slice(ind, index);\n if (i === 0 && firstCallback) {\n return firstCallback.call(_this5, value, indices.length);\n }\n var node;\n var current = _this5.currToken;\n var sourceIndex = current[_tokenize.FIELDS.START_POS] + indices[i];\n var source = getSource(current[1], current[2] + ind, current[3], current[2] + (index - 1));\n if (~hasClass.indexOf(ind)) {\n var classNameOpts = {\n value: value.slice(1),\n source: source,\n sourceIndex: sourceIndex\n };\n node = new _className[\"default\"](unescapeProp(classNameOpts, \"value\"));\n } else if (~hasId.indexOf(ind)) {\n var idOpts = {\n value: value.slice(1),\n source: source,\n sourceIndex: sourceIndex\n };\n node = new _id[\"default\"](unescapeProp(idOpts, \"value\"));\n } else {\n var tagOpts = {\n value: value,\n source: source,\n sourceIndex: sourceIndex\n };\n unescapeProp(tagOpts, \"value\");\n node = new _tag[\"default\"](tagOpts);\n }\n _this5.newNode(node, namespace);\n // Ensure that the namespace is used only once\n namespace = null;\n });\n this.position++;\n };\n _proto.word = function word(namespace) {\n var nextToken = this.nextToken;\n if (nextToken && this.content(nextToken) === '|') {\n this.position++;\n return this.namespace();\n }\n return this.splitWord(namespace);\n };\n _proto.loop = function loop() {\n while (this.position < this.tokens.length) {\n this.parse(true);\n }\n this.current._inferEndPosition();\n return this.root;\n };\n _proto.parse = function parse(throwOnParenthesis) {\n switch (this.currToken[_tokenize.FIELDS.TYPE]) {\n case tokens.space:\n this.space();\n break;\n case tokens.comment:\n this.comment();\n break;\n case tokens.openParenthesis:\n this.parentheses();\n break;\n case tokens.closeParenthesis:\n if (throwOnParenthesis) {\n this.missingParenthesis();\n }\n break;\n case tokens.openSquare:\n this.attribute();\n break;\n case tokens.dollar:\n case tokens.caret:\n case tokens.equals:\n case tokens.word:\n this.word();\n break;\n case tokens.colon:\n this.pseudo();\n break;\n case tokens.comma:\n this.comma();\n break;\n case tokens.asterisk:\n this.universal();\n break;\n case tokens.ampersand:\n this.nesting();\n break;\n case tokens.slash:\n case tokens.combinator:\n this.combinator();\n break;\n case tokens.str:\n this.string();\n break;\n // These cases throw; no break needed.\n case tokens.closeSquare:\n this.missingSquareBracket();\n case tokens.semicolon:\n this.missingBackslash();\n default:\n this.unexpected();\n }\n }\n\n /**\n * Helpers\n */;\n _proto.expected = function expected(description, index, found) {\n if (Array.isArray(description)) {\n var last = description.pop();\n description = description.join(', ') + \" or \" + last;\n }\n var an = /^[aeiou]/.test(description[0]) ? 'an' : 'a';\n if (!found) {\n return this.error(\"Expected \" + an + \" \" + description + \".\", {\n index: index\n });\n }\n return this.error(\"Expected \" + an + \" \" + description + \", found \\\"\" + found + \"\\\" instead.\", {\n index: index\n });\n };\n _proto.requiredSpace = function requiredSpace(space) {\n return this.options.lossy ? ' ' : space;\n };\n _proto.optionalSpace = function optionalSpace(space) {\n return this.options.lossy ? '' : space;\n };\n _proto.lossySpace = function lossySpace(space, required) {\n if (this.options.lossy) {\n return required ? ' ' : '';\n } else {\n return space;\n }\n };\n _proto.parseParenthesisToken = function parseParenthesisToken(token) {\n var content = this.content(token);\n if (token[_tokenize.FIELDS.TYPE] === tokens.space) {\n return this.requiredSpace(content);\n } else {\n return content;\n }\n };\n _proto.newNode = function newNode(node, namespace) {\n if (namespace) {\n if (/^ +$/.test(namespace)) {\n if (!this.options.lossy) {\n this.spaces = (this.spaces || '') + namespace;\n }\n namespace = true;\n }\n node.namespace = namespace;\n unescapeProp(node, \"namespace\");\n }\n if (this.spaces) {\n node.spaces.before = this.spaces;\n this.spaces = '';\n }\n return this.current.append(node);\n };\n _proto.content = function content(token) {\n if (token === void 0) {\n token = this.currToken;\n }\n return this.css.slice(token[_tokenize.FIELDS.START_POS], token[_tokenize.FIELDS.END_POS]);\n };\n /**\n * returns the index of the next non-whitespace, non-comment token.\n * returns -1 if no meaningful token is found.\n */\n _proto.locateNextMeaningfulToken = function locateNextMeaningfulToken(startPosition) {\n if (startPosition === void 0) {\n startPosition = this.position + 1;\n }\n var searchPosition = startPosition;\n while (searchPosition < this.tokens.length) {\n if (WHITESPACE_EQUIV_TOKENS[this.tokens[searchPosition][_tokenize.FIELDS.TYPE]]) {\n searchPosition++;\n continue;\n } else {\n return searchPosition;\n }\n }\n return -1;\n };\n _createClass(Parser, [{\n key: \"currToken\",\n get: function get() {\n return this.tokens[this.position];\n }\n }, {\n key: \"nextToken\",\n get: function get() {\n return this.tokens[this.position + 1];\n }\n }, {\n key: \"prevToken\",\n get: function get() {\n return this.tokens[this.position - 1];\n }\n }]);\n return Parser;\n}();\nexports[\"default\"] = Parser;\nmodule.exports = exports.default;", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\nvar _parser = _interopRequireDefault(require(\"./parser\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nvar Processor = /*#__PURE__*/function () {\n function Processor(func, options) {\n this.func = func || function noop() {};\n this.funcRes = null;\n this.options = options;\n }\n var _proto = Processor.prototype;\n _proto._shouldUpdateSelector = function _shouldUpdateSelector(rule, options) {\n if (options === void 0) {\n options = {};\n }\n var merged = Object.assign({}, this.options, options);\n if (merged.updateSelector === false) {\n return false;\n } else {\n return typeof rule !== \"string\";\n }\n };\n _proto._isLossy = function _isLossy(options) {\n if (options === void 0) {\n options = {};\n }\n var merged = Object.assign({}, this.options, options);\n if (merged.lossless === false) {\n return true;\n } else {\n return false;\n }\n };\n _proto._root = function _root(rule, options) {\n if (options === void 0) {\n options = {};\n }\n var parser = new _parser[\"default\"](rule, this._parseOptions(options));\n return parser.root;\n };\n _proto._parseOptions = function _parseOptions(options) {\n return {\n lossy: this._isLossy(options)\n };\n };\n _proto._run = function _run(rule, options) {\n var _this = this;\n if (options === void 0) {\n options = {};\n }\n return new Promise(function (resolve, reject) {\n try {\n var root = _this._root(rule, options);\n Promise.resolve(_this.func(root)).then(function (transform) {\n var string = undefined;\n if (_this._shouldUpdateSelector(rule, options)) {\n string = root.toString();\n rule.selector = string;\n }\n return {\n transform: transform,\n root: root,\n string: string\n };\n }).then(resolve, reject);\n } catch (e) {\n reject(e);\n return;\n }\n });\n };\n _proto._runSync = function _runSync(rule, options) {\n if (options === void 0) {\n options = {};\n }\n var root = this._root(rule, options);\n var transform = this.func(root);\n if (transform && typeof transform.then === \"function\") {\n throw new Error(\"Selector processor returned a promise to a synchronous call.\");\n }\n var string = undefined;\n if (options.updateSelector && typeof rule !== \"string\") {\n string = root.toString();\n rule.selector = string;\n }\n return {\n transform: transform,\n root: root,\n string: string\n };\n }\n\n /**\n * Process rule into a selector AST.\n *\n * @param rule {postcss.Rule | string} The css selector to be processed\n * @param options The options for processing\n * @returns {Promise<parser.Root>} The AST of the selector after processing it.\n */;\n _proto.ast = function ast(rule, options) {\n return this._run(rule, options).then(function (result) {\n return result.root;\n });\n }\n\n /**\n * Process rule into a selector AST synchronously.\n *\n * @param rule {postcss.Rule | string} The css selector to be processed\n * @param options The options for processing\n * @returns {parser.Root} The AST of the selector after processing it.\n */;\n _proto.astSync = function astSync(rule, options) {\n return this._runSync(rule, options).root;\n }\n\n /**\n * Process a selector into a transformed value asynchronously\n *\n * @param rule {postcss.Rule | string} The css selector to be processed\n * @param options The options for processing\n * @returns {Promise<any>} The value returned by the processor.\n */;\n _proto.transform = function transform(rule, options) {\n return this._run(rule, options).then(function (result) {\n return result.transform;\n });\n }\n\n /**\n * Process a selector into a transformed value synchronously.\n *\n * @param rule {postcss.Rule | string} The css selector to be processed\n * @param options The options for processing\n * @returns {any} The value returned by the processor.\n */;\n _proto.transformSync = function transformSync(rule, options) {\n return this._runSync(rule, options).transform;\n }\n\n /**\n * Process a selector into a new selector string asynchronously.\n *\n * @param rule {postcss.Rule | string} The css selector to be processed\n * @param options The options for processing\n * @returns {string} the selector after processing.\n */;\n _proto.process = function process(rule, options) {\n return this._run(rule, options).then(function (result) {\n return result.string || result.root.toString();\n });\n }\n\n /**\n * Process a selector into a new selector string synchronously.\n *\n * @param rule {postcss.Rule | string} The css selector to be processed\n * @param options The options for processing\n * @returns {string} the selector after processing.\n */;\n _proto.processSync = function processSync(rule, options) {\n var result = this._runSync(rule, options);\n return result.string || result.root.toString();\n };\n return Processor;\n}();\nexports[\"default\"] = Processor;\nmodule.exports = exports.default;", "\"use strict\";\n\nexports.__esModule = true;\nexports.universal = exports.tag = exports.string = exports.selector = exports.root = exports.pseudo = exports.nesting = exports.id = exports.comment = exports.combinator = exports.className = exports.attribute = void 0;\nvar _attribute = _interopRequireDefault(require(\"./attribute\"));\nvar _className = _interopRequireDefault(require(\"./className\"));\nvar _combinator = _interopRequireDefault(require(\"./combinator\"));\nvar _comment = _interopRequireDefault(require(\"./comment\"));\nvar _id = _interopRequireDefault(require(\"./id\"));\nvar _nesting = _interopRequireDefault(require(\"./nesting\"));\nvar _pseudo = _interopRequireDefault(require(\"./pseudo\"));\nvar _root = _interopRequireDefault(require(\"./root\"));\nvar _selector = _interopRequireDefault(require(\"./selector\"));\nvar _string = _interopRequireDefault(require(\"./string\"));\nvar _tag = _interopRequireDefault(require(\"./tag\"));\nvar _universal = _interopRequireDefault(require(\"./universal\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nvar attribute = function attribute(opts) {\n return new _attribute[\"default\"](opts);\n};\nexports.attribute = attribute;\nvar className = function className(opts) {\n return new _className[\"default\"](opts);\n};\nexports.className = className;\nvar combinator = function combinator(opts) {\n return new _combinator[\"default\"](opts);\n};\nexports.combinator = combinator;\nvar comment = function comment(opts) {\n return new _comment[\"default\"](opts);\n};\nexports.comment = comment;\nvar id = function id(opts) {\n return new _id[\"default\"](opts);\n};\nexports.id = id;\nvar nesting = function nesting(opts) {\n return new _nesting[\"default\"](opts);\n};\nexports.nesting = nesting;\nvar pseudo = function pseudo(opts) {\n return new _pseudo[\"default\"](opts);\n};\nexports.pseudo = pseudo;\nvar root = function root(opts) {\n return new _root[\"default\"](opts);\n};\nexports.root = root;\nvar selector = function selector(opts) {\n return new _selector[\"default\"](opts);\n};\nexports.selector = selector;\nvar string = function string(opts) {\n return new _string[\"default\"](opts);\n};\nexports.string = string;\nvar tag = function tag(opts) {\n return new _tag[\"default\"](opts);\n};\nexports.tag = tag;\nvar universal = function universal(opts) {\n return new _universal[\"default\"](opts);\n};\nexports.universal = universal;", "\"use strict\";\n\nexports.__esModule = true;\nexports.isComment = exports.isCombinator = exports.isClassName = exports.isAttribute = void 0;\nexports.isContainer = isContainer;\nexports.isIdentifier = void 0;\nexports.isNamespace = isNamespace;\nexports.isNesting = void 0;\nexports.isNode = isNode;\nexports.isPseudo = void 0;\nexports.isPseudoClass = isPseudoClass;\nexports.isPseudoElement = isPseudoElement;\nexports.isUniversal = exports.isTag = exports.isString = exports.isSelector = exports.isRoot = void 0;\nvar _types = require(\"./types\");\nvar _IS_TYPE;\nvar IS_TYPE = (_IS_TYPE = {}, _IS_TYPE[_types.ATTRIBUTE] = true, _IS_TYPE[_types.CLASS] = true, _IS_TYPE[_types.COMBINATOR] = true, _IS_TYPE[_types.COMMENT] = true, _IS_TYPE[_types.ID] = true, _IS_TYPE[_types.NESTING] = true, _IS_TYPE[_types.PSEUDO] = true, _IS_TYPE[_types.ROOT] = true, _IS_TYPE[_types.SELECTOR] = true, _IS_TYPE[_types.STRING] = true, _IS_TYPE[_types.TAG] = true, _IS_TYPE[_types.UNIVERSAL] = true, _IS_TYPE);\nfunction isNode(node) {\n return typeof node === \"object\" && IS_TYPE[node.type];\n}\nfunction isNodeType(type, node) {\n return isNode(node) && node.type === type;\n}\nvar isAttribute = isNodeType.bind(null, _types.ATTRIBUTE);\nexports.isAttribute = isAttribute;\nvar isClassName = isNodeType.bind(null, _types.CLASS);\nexports.isClassName = isClassName;\nvar isCombinator = isNodeType.bind(null, _types.COMBINATOR);\nexports.isCombinator = isCombinator;\nvar isComment = isNodeType.bind(null, _types.COMMENT);\nexports.isComment = isComment;\nvar isIdentifier = isNodeType.bind(null, _types.ID);\nexports.isIdentifier = isIdentifier;\nvar isNesting = isNodeType.bind(null, _types.NESTING);\nexports.isNesting = isNesting;\nvar isPseudo = isNodeType.bind(null, _types.PSEUDO);\nexports.isPseudo = isPseudo;\nvar isRoot = isNodeType.bind(null, _types.ROOT);\nexports.isRoot = isRoot;\nvar isSelector = isNodeType.bind(null, _types.SELECTOR);\nexports.isSelector = isSelector;\nvar isString = isNodeType.bind(null, _types.STRING);\nexports.isString = isString;\nvar isTag = isNodeType.bind(null, _types.TAG);\nexports.isTag = isTag;\nvar isUniversal = isNodeType.bind(null, _types.UNIVERSAL);\nexports.isUniversal = isUniversal;\nfunction isPseudoElement(node) {\n return isPseudo(node) && node.value && (node.value.startsWith(\"::\") || node.value.toLowerCase() === \":before\" || node.value.toLowerCase() === \":after\" || node.value.toLowerCase() === \":first-letter\" || node.value.toLowerCase() === \":first-line\");\n}\nfunction isPseudoClass(node) {\n return isPseudo(node) && !isPseudoElement(node);\n}\nfunction isContainer(node) {\n return !!(isNode(node) && node.walk);\n}\nfunction isNamespace(node) {\n return isAttribute(node) || isTag(node);\n}", "\"use strict\";\n\nexports.__esModule = true;\nvar _types = require(\"./types\");\nObject.keys(_types).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (key in exports && exports[key] === _types[key]) return;\n exports[key] = _types[key];\n});\nvar _constructors = require(\"./constructors\");\nObject.keys(_constructors).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (key in exports && exports[key] === _constructors[key]) return;\n exports[key] = _constructors[key];\n});\nvar _guards = require(\"./guards\");\nObject.keys(_guards).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (key in exports && exports[key] === _guards[key]) return;\n exports[key] = _guards[key];\n});", "\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\nvar _processor = _interopRequireDefault(require(\"./processor\"));\nvar selectors = _interopRequireWildcard(require(\"./selectors\"));\nfunction _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== \"function\") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }\nfunction _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== \"object\" && typeof obj !== \"function\") { return { \"default\": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj[\"default\"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nvar parser = function parser(processor) {\n return new _processor[\"default\"](processor);\n};\nObject.assign(parser, selectors);\ndelete parser.__esModule;\nvar _default = parser;\nexports[\"default\"] = _default;\nmodule.exports = exports.default;", "import { splitDepID } from '@vltpkg/dep-id'\nimport type { DepID, DepIDTuple } from '@vltpkg/dep-id'\nimport { error } from '@vltpkg/error-cause'\nimport { parse, Version } from '@vltpkg/semver'\nimport { defaultRegistryName, Spec } from '@vltpkg/spec'\nimport type { GitSelectorParsed } from '@vltpkg/spec'\nimport { Monorepo } from '@vltpkg/workspaces'\nimport { relative, resolve } from 'node:path'\n\n/**\n * Return true if the node referenced by this DepID would satisfy the\n * supplied Spec object.\n */\nexport const satisfies = (\n id: DepID | undefined,\n spec: Spec,\n fromLocation = process.cwd(),\n projectRoot = process.cwd(),\n monorepo?: Monorepo,\n): boolean =>\n !!id &&\n satisfiesTuple(\n splitDepID(id),\n spec,\n fromLocation,\n projectRoot,\n monorepo,\n )\n\nexport const satisfiesTuple = (\n tuple: DepIDTuple,\n spec: Spec,\n fromLocation = process.cwd(),\n projectRoot = process.cwd(),\n monorepo?: Monorepo,\n): boolean => {\n const { options } = spec\n spec = spec.final\n const [type, first, second] = tuple\n if (spec.type !== type) return false\n\n switch (spec.type) {\n case 'registry': {\n /* c8 ignore start - should be impossible */\n if (!first) {\n // must be from the default registry\n if (spec.registry !== options.registry) {\n return false\n }\n /* c8 ignore stop */\n } else {\n let namedRegistry = options.registries[first]\n /* c8 ignore next 3 */\n if (!namedRegistry && first === defaultRegistryName) {\n namedRegistry = options.registry\n }\n if (namedRegistry && namedRegistry !== spec.registry) {\n // we know the name, and it's not the registry being used\n return false\n } else if (!namedRegistry && first !== spec.registry) {\n // an explicit registry URL, but does not match\n return false\n }\n }\n /* c8 ignore next */\n if (!second) throw error('Invalid DepID', { found: tuple })\n const [name, version] = parseNameVer(second)\n return (\n // mismatched name always invalid\n name !== spec.name || !version ? false\n // if just a dist-tag, assume valid\n : !spec.range ? true\n : spec.range.test(Version.parse(version))\n )\n }\n\n case 'file': {\n /* c8 ignore next - should be impossible */\n if (spec.file === undefined) return false\n const resolvedSpec = resolve(\n projectRoot,\n fromLocation,\n spec.file,\n )\n const resolvedId = resolve(projectRoot, first)\n // valid if the relative path is '', refers to the same path\n return !relative(resolvedSpec, resolvedId)\n }\n\n case 'workspace': {\n monorepo ??= Monorepo.load(projectRoot)\n /* c8 ignore next */\n if (!spec.workspace) return false\n const fromID = monorepo.get(first)\n const fromSpec = monorepo.get(spec.workspace)\n if (fromID !== fromSpec || !fromSpec || !fromID) return false\n if (!spec.range) return true\n const v = parse(fromID.manifest.version ?? '')\n return !!v && spec.range.test(v)\n }\n\n case 'remote': {\n return spec.remoteURL === first\n }\n\n case 'git': {\n const {\n gitRemote,\n gitSelectorParsed = {},\n gitSelector,\n gitCommittish,\n namedGitHost,\n namedGitHostPath,\n } = spec\n if (gitRemote !== first) {\n if (namedGitHost && namedGitHostPath) {\n const ngh = `${namedGitHost}:`\n if (first.startsWith(ngh)) {\n if (first !== ngh + namedGitHostPath) return false\n } else return false\n } else return false\n }\n if (gitSelector && !second) return false\n /* c8 ignore next - always set to something, even if empty */\n const [parsed, committish] = Spec.parseGitSelector(second ?? '')\n if (gitCommittish && committish)\n return committish.startsWith(gitCommittish)\n for (const [k, v] of Object.entries(gitSelectorParsed)) {\n if (parsed[k as keyof GitSelectorParsed] !== v) return false\n }\n return true\n }\n\n /* c8 ignore start */\n default: {\n throw error('Invalid spec type', { spec })\n }\n }\n /* c8 ignore stop */\n}\n\nconst parseNameVer = (nv: string): [string, string] => {\n const at = nv.lastIndexOf('@')\n // if it's 0, means @scoped without a version\n return at <= 0 ?\n [nv, '']\n : [nv.substring(0, at), nv.substring(at + 1)]\n}\n", "import { satisfies } from '@vltpkg/satisfies'\nimport type { Spec } from '@vltpkg/spec'\nimport { inspect } from 'node:util'\nimport type { InspectOptions } from 'node:util'\nimport type { DependencyTypeShort, EdgeLike } from '@vltpkg/types'\nimport type { Node } from './node.ts'\n\nconst kCustomInspect = Symbol.for('nodejs.util.inspect.custom')\n\nexport class Edge implements EdgeLike {\n get [Symbol.toStringTag]() {\n return '@vltpkg/graph.Edge'\n }\n\n [kCustomInspect](_: number, options: InspectOptions) {\n const str = inspect(\n {\n from: this.from.id,\n type: this.type,\n spec: String(this.spec),\n to: this.to?.id,\n },\n options,\n )\n return `${this[Symbol.toStringTag]} ${str}`\n }\n\n /**\n * The Node this Edge is connecting from, this is usually the dependent.\n */\n from: Node\n\n /**\n * The node this Edge is connecting to, this is usually a direct dependency.\n */\n to?: Node\n\n /**\n * What type of dependency relationship `from` and `to` nodes have.\n */\n type: DependencyTypeShort\n\n /**\n * The defined spec value for `to` as parsed from the dependent metadata.\n */\n spec: Spec\n\n constructor(\n type: DependencyTypeShort,\n spec: Spec,\n from: Node,\n to?: Node,\n ) {\n this.from = from\n this.to = to\n this.type = type\n this.spec = spec\n }\n\n /**\n * The name of the dependency `to` as defined in the dependent metadata.\n */\n get name() {\n return this.spec.name\n }\n\n /**\n * This edge was defined as part of a `devDependencies` in `package.json`\n */\n get dev(): boolean {\n return this.type === 'dev'\n }\n\n get optional(): boolean {\n return this.type === 'peerOptional' || this.type === 'optional'\n }\n\n get peer(): boolean {\n return this.type === 'peer' || this.type === 'peerOptional'\n }\n\n get peerOptional(): boolean {\n return this.type === 'peerOptional'\n }\n\n valid(): boolean {\n return !this.to ?\n this.optional\n : satisfies(\n this.to.id,\n this.spec,\n this.from.location,\n this.from.projectRoot,\n )\n }\n\n toJSON() {\n return {\n from: this.from.id,\n to: this.to?.id,\n type: this.type,\n spec: String(this.spec),\n }\n }\n\n toString() {\n const to = `${this.name}${this.to ? '' : ' (missing)'}`\n return `Edge from: ${this.from.id} --|${this.type}|--> ${to}`\n }\n}\n", "import { splitDepID } from '@vltpkg/dep-id/browser'\nimport { defaultRegistryName } from '@vltpkg/spec/browser'\nimport type { NodeLike } from '@vltpkg/types'\n\nexport const stringifyNode = (node?: NodeLike) => {\n if (!node) return ''\n const version = node.version ? `@${node.version}` : ''\n const [type, ref, nameVersion] = splitDepID(node.id)\n\n if (type === 'registry') {\n let prefix = `${defaultRegistryName}:`\n if (ref) {\n if (/^https?:\\/\\//.test(ref)) {\n prefix = `registry:${ref}#`\n } else {\n prefix = `${ref}:`\n }\n }\n return `${prefix}${nameVersion}`\n } else if (type === 'workspace') {\n return `workspace:${node.name}`\n } else if (type === 'file' && node.mainImporter) {\n return `root:${node.name}`\n } else {\n // node.name getter will return the id if the package has no name\n // property so here we check for that in order to return `type(ref)` only\n const nameVersion =\n node.name !== node.id ? `:${node.name}${version}` : ''\n return `${type}(${ref})${nameVersion}`\n }\n}\n", "import type { PathScurry } from 'path-scurry'\nimport {\n isPackageNameConfused,\n getId,\n hydrateTuple,\n splitDepID,\n} from '@vltpkg/dep-id'\nimport type { DepID, DepIDTuple } from '@vltpkg/dep-id'\nimport { typeError } from '@vltpkg/error-cause'\nimport type { Spec, SpecOptions } from '@vltpkg/spec'\nimport { expandNormalizedManifestSymbols } from '@vltpkg/types'\nimport type {\n Integrity,\n NormalizedManifest,\n DependencyTypeShort,\n GraphLike,\n NodeLike,\n} from '@vltpkg/types'\nimport { Edge } from './edge.ts'\nimport type { Graph } from './graph.ts'\nimport { stringifyNode } from './stringify-node.ts'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { GraphModifier } from './modifiers.ts'\n\nexport type NodeOptions = SpecOptions & {\n projectRoot: string\n graph: GraphLike\n}\n\nexport class Node implements NodeLike {\n get [Symbol.toStringTag]() {\n return '@vltpkg/graph.Node'\n }\n\n #options: SpecOptions\n #location?: string\n #rawManifest?: NormalizedManifest\n\n #optional = false\n /**\n * True if a node is only reachable via optional or peerOptional edges from\n * any importer.\n *\n * Setting this to false, if previously set to true, will also unset\n * the flag on any optional-flagged non-optional dependencies.\n */\n get optional() {\n return this.#optional\n }\n set optional(optional: boolean) {\n const before = this.#optional\n this.#optional = optional\n if (before && !optional) {\n // unset for all deps, as well\n for (const { to, optional } of this.edgesOut.values()) {\n if (!optional && to?.optional) to.optional = false\n }\n }\n }\n\n isOptional(): this is Node & { optional: true } {\n return this.#optional\n }\n\n #dev = false\n /**\n * True if a node is only reachable via dev edges from any importer.\n *\n * Setting this to false, if previously set to true, will also unset\n * the flag on any dev-flagged non-dev dependencies.\n */\n get dev() {\n return this.#dev\n }\n set dev(dev: boolean) {\n const before = this.#dev\n this.#dev = dev\n if (before && !dev) {\n // unset for all deps, as well\n for (const { to, dev } of this.edgesOut.values()) {\n if (!dev && to?.dev) to.dev = false\n }\n }\n }\n\n isDev(): this is Node & { dev: true } {\n return this.#dev\n }\n\n /**\n * True if there's a manifest-confused package name.\n */\n confused = false\n\n /**\n * True if this node has been extracted to the file system.\n */\n extracted = false\n\n /**\n * List of edges coming into this node.\n */\n edgesIn = new Set<Edge>()\n\n /**\n * List of edges from this node into other nodes. This usually represents\n * that the connected node is a direct dependency of this node.\n */\n edgesOut = new Map<string, Edge>()\n\n /**\n * A `mainImporter` node may have workspace connected to it,\n * equivalent to its `edgesOut` linked deps.\n */\n workspaces: Map<string, Edge> | undefined\n\n /**\n * A reference to the {@link DepID} this node represents in the graph.\n */\n id: DepID\n\n /**\n * True if this node is an importer node.\n */\n importer = false\n\n /**\n * True if this node is the project root node.\n */\n mainImporter = false\n\n /**\n * A reference to the graph this node is a part of.\n */\n graph: Graph\n\n /**\n * The manifest integrity value.\n */\n integrity?: Integrity\n\n /**\n * The manifest this node represents in the graph.\n */\n manifest?: NormalizedManifest\n\n /**\n * Project where this node resides\n */\n projectRoot: string\n\n /**\n * For registry nodes, this is the registry we fetched them from.\n * Needed because their un-prefixed dependencies need to come from\n * the same registry, if it's not the default.\n */\n registry?: string\n\n /**\n * If this node has been modified as part of applying a {@link GraphModifier}\n * then this field will contain the modifier query that was applied.\n * Otherwise, it will be `undefined`.\n */\n modifier: string | undefined\n\n /**\n * The name of the package represented by this node, this is usually\n * equivalent to `manifest.name` but in a few ways it may differ such as\n * nodes loaded from a lockfile that lacks a loaded manifest.\n * This field should be used to retrieve package names instead.\n */\n #name?: string\n get name() {\n if (this.#name) return this.#name\n this.#name = this.id\n return this.#name\n }\n\n /**\n * The version of the package represented by this node, this is usually\n * equivalent to `manifest.version` but in a few ways it may differ such as\n * nodes loaded from a lockfile that lacks a loaded manifest.\n * This field should be used to retrieve package versions instead.\n */\n version?: string\n\n /**\n * An address {@link PackageInfoClient} may use to extract this package.\n */\n resolved?: string\n\n /**\n * Platform requirements (engines, os, cpu) extracted from manifest.\n * Stored separately for optional dependencies to enable platform checks\n * when manifest is not loaded.\n */\n platform?: {\n engines?: Record<string, string>\n os?: string[] | string\n cpu?: string[] | string\n }\n\n /**\n * Record of binary names to their paths in the package, if any.\n */\n bins?: Record<string, string>\n\n /**\n * True if this node has been built as part of the reify step.\n */\n built = false\n\n /**\n * Build state of this node - tracks whether it needs building, has been built, or failed.\n * - 'none': No build state (default)\n * - 'needed': Node needs to be built\n * - 'built': Node has been successfully built\n * - 'failed': Node build has failed\n */\n buildState: 'none' | 'needed' | 'built' | 'failed' = 'none'\n\n /**\n * Deterministic unique string used to identify (and ultimately duplicate)\n * nodes that are affected by a peer context set modified resolution.\n * These are appended to the node {@link DepID} as the `extra` suffix.\n */\n peerSetHash?: string\n\n /**\n * True if this node is detached from the graph.\n * This is used to indicate that the node is not part of the graph\n * although the node is still available as part of the resolution process.\n * Allows for skipping fetching manifests for detached nodes.\n */\n detached = false\n\n /**\n * The file system location for this node.\n */\n get location(): string {\n if (this.#location) {\n return this.#location\n }\n this.#location = `./node_modules/.vlt/${this.id}/node_modules/${this.name}`\n // if using the default location, it is in the store\n this.inVltStore = () => true\n return this.#location\n }\n\n set location(location: string) {\n this.#location = location\n // reset memoization, since it might be elsewhere now\n if (this.inVltStore !== Node.prototype.inVltStore) {\n this.inVltStore = Node.prototype.inVltStore\n }\n }\n\n /**\n * The resolved location of the node in the file system.\n */\n resolvedLocation(scurry: PathScurry): string {\n return scurry.cwd.resolve(this.location).fullpath()\n }\n\n /**\n * The location of the node_modules folder where this node's edgesOut\n * should be linked into. For nodes in the store, this is the parent\n * directory, since they're extracted into a node_modules folder\n * side by side with links to their deps. For nodes outside of the store\n * (ie, importers and arbitrary link deps) this is the node_modules folder\n * directly inside the node's directory.\n */\n nodeModules(scurry: PathScurry): string {\n const loc = this.resolvedLocation(scurry)\n return this.inVltStore() ?\n loc.substring(0, loc.length - this.name.length - 1)\n : scurry.resolve(loc, 'node_modules')\n }\n\n constructor(\n options: NodeOptions,\n id?: DepID,\n manifest?: NormalizedManifest,\n spec?: Spec,\n name?: string,\n version?: string,\n ) {\n this.#options = options\n this.projectRoot = options.projectRoot\n if (id) {\n this.id = id\n } else {\n if (!manifest || !spec) {\n throw typeError(\n 'A new Node needs either a manifest & spec or an id parameter',\n {\n manifest,\n },\n )\n }\n this.id = getId(spec, manifest)\n }\n this.graph = options.graph as Graph\n this.manifest = manifest\n\n this.#name = name || this.manifest?.name\n this.version = version || this.manifest?.version\n }\n\n /**\n * return true if this node is located in the vlt store\n * memoized the first time it's called, since the store location\n * doesn't change within the context of a single operation.\n */\n inVltStore(): boolean {\n // technically this just means it's in *a* vlt store, but we can safely\n // assume that a user won't construct a path like this by accident,\n // and there's only ever one store in any given project.\n const inStore = this.location.endsWith(\n `.vlt/${this.id}/node_modules/${this.name}`,\n )\n this.inVltStore = () => inStore\n return inStore\n }\n\n #registryNodeResolved(tuple: DepIDTuple) {\n const spec = hydrateTuple(tuple, this.#name, this.#options)\n this.resolved =\n this.manifest?.dist?.tarball || spec.conventionalRegistryTarball\n this.integrity ??= this.manifest?.dist?.integrity\n }\n\n get options() {\n return this.#options\n }\n\n /* c8 ignore next */\n set options(_opts: SpecOptions) {}\n\n equals(other: Node) {\n return this.id === other.id && this.location === other.location\n }\n\n /**\n * Sets the node as an importer along with its location.\n */\n setImporterLocation(location: string) {\n this.#location = location\n this.importer = true\n }\n\n /**\n * Sets the appropriate resolve / integrity value for this node.\n * Note that other places might also set these values, like for\n * example the lockfile that might have already have this info.\n */\n setResolved() {\n // file | remote | workspace type of ids all points to a URI that\n // can be used as the `resolved` value, so we split the dep id\n // for these cases.\n const tuple = splitDepID(this.id)\n const [type, resolved] = tuple\n switch (type) {\n case 'remote': {\n this.resolved = resolved\n this.integrity ??= this.manifest?.dist?.integrity\n break\n }\n case 'registry':\n this.#registryNodeResolved(tuple)\n break\n default:\n this.resolved = resolved\n break\n }\n }\n\n setDefaultLocation() {\n const def = `./node_modules/.vlt/${this.id}/node_modules/${this.name}`\n\n // only relocate if the location is in node_modules already\n if (\n !this.importer &&\n (!this.#location ||\n (this.#location !== def &&\n /^(?:\\.\\/)?node_modules\\//.test(this.#location)))\n ) {\n this.#location = def\n }\n }\n\n /**\n * Add an edge from this node connecting it to a direct dependency.\n */\n addEdgesTo(type: DependencyTypeShort, spec: Spec, node?: Node) {\n const edge = new Edge(type, spec, this, node)\n node?.edgesIn.add(edge)\n this.edgesOut.set(spec.name, edge)\n return edge\n }\n\n /**\n * The raw manifest before any modifications.\n * If not set, falls back to the current manifest.\n */\n get rawManifest(): NormalizedManifest | undefined {\n return this.#rawManifest ?? this.manifest\n }\n\n /**\n * Sets this node as having a manifest-confused manifest.\n */\n setConfusedManifest(\n fixed: NormalizedManifest,\n confused?: NormalizedManifest,\n ) {\n this.manifest = fixed\n this.#rawManifest = confused\n this.confused = true\n this.#name = this.manifest.name\n }\n\n /**\n * Sets this node as having a manifest-confused manifest.\n */\n maybeSetConfusedManifest(\n spec: Spec,\n confused?: NormalizedManifest,\n ) {\n if (isPackageNameConfused(spec, this.manifest?.name)) {\n this.setConfusedManifest(\n {\n ...this.manifest,\n name: spec.name,\n },\n confused,\n )\n }\n }\n\n toJSON() {\n return {\n id: this.id,\n name: this.name,\n version: this.version,\n location: this.location,\n importer: this.importer,\n manifest:\n this.manifest &&\n expandNormalizedManifestSymbols(this.manifest),\n projectRoot: this.projectRoot,\n integrity: this.integrity,\n resolved: this.resolved,\n dev: this.dev,\n optional: this.optional,\n confused: this.confused,\n modifier: this.modifier,\n platform: this.platform,\n buildState: this.buildState,\n ...(this.peerSetHash ?\n { peerSetHash: this.peerSetHash }\n : undefined),\n ...(this.confused ?\n { rawManifest: this.#rawManifest }\n : undefined),\n }\n }\n\n toString() {\n return stringifyNode(this)\n }\n}\n\nexport const isNode = (value: unknown): value is Node => {\n return (\n typeof value === 'object' &&\n value != null &&\n 'id' in value &&\n 'manifest' in value &&\n (value as Node)[Symbol.toStringTag] === '@vltpkg/graph.Node'\n )\n}\n\nexport const asNode = (value: unknown): Node => {\n if (!isNode(value)) {\n throw typeError('Expected a node', { found: value })\n }\n return value\n}\n", "/**\n * This is not the set of all possible signals.\n *\n * It IS, however, the set of all signals that trigger\n * an exit on either Linux or BSD systems. Linux is a\n * superset of the signal names supported on BSD, and\n * the unknown signals just fail to register, so we can\n * catch that easily enough.\n *\n * Windows signals are a different set, since there are\n * signals that terminate Windows processes, but don't\n * terminate (or don't even exist) on Posix systems.\n *\n * Don't bother with SIGKILL. It's uncatchable, which\n * means that we can't fire any callbacks anyway.\n *\n * If a user does happen to register a handler on a non-\n * fatal signal like SIGWINCH or something, and then\n * exit, it'll end up firing `process.emit('exit')`, so\n * the handler will be fired anyway.\n *\n * SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised\n * artificially, inherently leave the process in a\n * state from which it is not safe to try and enter JS\n * listeners.\n */\nexport const signals: NodeJS.Signals[] = []\nsignals.push('SIGHUP', 'SIGINT', 'SIGTERM')\n\nif (process.platform !== 'win32') {\n signals.push(\n 'SIGALRM',\n 'SIGABRT',\n 'SIGVTALRM',\n 'SIGXCPU',\n 'SIGXFSZ',\n 'SIGUSR2',\n 'SIGTRAP',\n 'SIGSYS',\n 'SIGQUIT',\n 'SIGIOT'\n // should detect profiler and enable/disable accordingly.\n // see #21\n // 'SIGPROF'\n )\n}\n\nif (process.platform === 'linux') {\n signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT')\n}\n", "// Note: since nyc uses this module to output coverage, any lines\n// that are in the direct sync flow of nyc's outputCoverage are\n// ignored, since we can never get coverage for them.\n// grab a reference to node's real process object right away\nimport { signals } from './signals.js'\nexport { signals }\n\n// just a loosened process type so we can do some evil things\ntype ProcessRE = NodeJS.Process & {\n reallyExit: (code?: number | undefined | null) => any\n emit: (ev: string, ...a: any[]) => any\n}\n\nconst processOk = (process: any): process is ProcessRE =>\n !!process &&\n typeof process === 'object' &&\n typeof process.removeListener === 'function' &&\n typeof process.emit === 'function' &&\n typeof process.reallyExit === 'function' &&\n typeof process.listeners === 'function' &&\n typeof process.kill === 'function' &&\n typeof process.pid === 'number' &&\n typeof process.on === 'function'\n\nconst kExitEmitter = Symbol.for('signal-exit emitter')\nconst global: typeof globalThis & { [kExitEmitter]?: Emitter } = globalThis\nconst ObjectDefineProperty = Object.defineProperty.bind(Object)\n\n/**\n * A function that takes an exit code and signal as arguments\n *\n * In the case of signal exits *only*, a return value of true\n * will indicate that the signal is being handled, and we should\n * not synthetically exit with the signal we received. Regardless\n * of the handler return value, the handler is unloaded when an\n * otherwise fatal signal is received, so you get exactly 1 shot\n * at it, unless you add another onExit handler at that point.\n *\n * In the case of numeric code exits, we may already have committed\n * to exiting the process, for example via a fatal exception or\n * unhandled promise rejection, so it is impossible to stop safely.\n */\nexport type Handler = (\n code: number | null | undefined,\n signal: NodeJS.Signals | null\n) => true | void\ntype ExitEvent = 'afterExit' | 'exit'\ntype Emitted = { [k in ExitEvent]: boolean }\ntype Listeners = { [k in ExitEvent]: Handler[] }\n\n// teeny special purpose ee\nclass Emitter {\n emitted: Emitted = {\n afterExit: false,\n exit: false,\n }\n\n listeners: Listeners = {\n afterExit: [],\n exit: [],\n }\n\n count: number = 0\n id: number = Math.random()\n\n constructor() {\n if (global[kExitEmitter]) {\n return global[kExitEmitter]\n }\n ObjectDefineProperty(global, kExitEmitter, {\n value: this,\n writable: false,\n enumerable: false,\n configurable: false,\n })\n }\n\n on(ev: ExitEvent, fn: Handler) {\n this.listeners[ev].push(fn)\n }\n\n removeListener(ev: ExitEvent, fn: Handler) {\n const list = this.listeners[ev]\n const i = list.indexOf(fn)\n /* c8 ignore start */\n if (i === -1) {\n return\n }\n /* c8 ignore stop */\n if (i === 0 && list.length === 1) {\n list.length = 0\n } else {\n list.splice(i, 1)\n }\n }\n\n emit(\n ev: ExitEvent,\n code: number | null | undefined,\n signal: NodeJS.Signals | null\n ): boolean {\n if (this.emitted[ev]) {\n return false\n }\n this.emitted[ev] = true\n let ret: boolean = false\n for (const fn of this.listeners[ev]) {\n ret = fn(code, signal) === true || ret\n }\n if (ev === 'exit') {\n ret = this.emit('afterExit', code, signal) || ret\n }\n return ret\n }\n}\n\nabstract class SignalExitBase {\n abstract onExit(cb: Handler, opts?: { alwaysLast?: boolean }): () => void\n abstract load(): void\n abstract unload(): void\n}\n\nconst signalExitWrap = <T extends SignalExitBase>(handler: T) => {\n return {\n onExit(cb: Handler, opts?: { alwaysLast?: boolean }) {\n return handler.onExit(cb, opts)\n },\n load() {\n return handler.load()\n },\n unload() {\n return handler.unload()\n },\n }\n}\n\nclass SignalExitFallback extends SignalExitBase {\n onExit() {\n return () => {}\n }\n load() {}\n unload() {}\n}\n\nclass SignalExit extends SignalExitBase {\n // \"SIGHUP\" throws an `ENOSYS` error on Windows,\n // so use a supported signal instead\n /* c8 ignore start */\n #hupSig = process.platform === 'win32' ? 'SIGINT' : 'SIGHUP'\n /* c8 ignore stop */\n #emitter = new Emitter()\n #process: ProcessRE\n #originalProcessEmit: ProcessRE['emit']\n #originalProcessReallyExit: ProcessRE['reallyExit']\n\n #sigListeners: { [k in NodeJS.Signals]?: () => void } = {}\n #loaded: boolean = false\n\n constructor(process: ProcessRE) {\n super()\n this.#process = process\n // { <signal>: <listener fn>, ... }\n this.#sigListeners = {}\n for (const sig of signals) {\n this.#sigListeners[sig] = () => {\n // If there are no other listeners, an exit is coming!\n // Simplest way: remove us and then re-send the signal.\n // We know that this will kill the process, so we can\n // safely emit now.\n const listeners = this.#process.listeners(sig)\n let { count } = this.#emitter\n // This is a workaround for the fact that signal-exit v3 and signal\n // exit v4 are not aware of each other, and each will attempt to let\n // the other handle it, so neither of them do. To correct this, we\n // detect if we're the only handler *except* for previous versions\n // of signal-exit, and increment by the count of listeners it has\n // created.\n /* c8 ignore start */\n const p = process as unknown as {\n __signal_exit_emitter__?: { count: number }\n }\n if (\n typeof p.__signal_exit_emitter__ === 'object' &&\n typeof p.__signal_exit_emitter__.count === 'number'\n ) {\n count += p.__signal_exit_emitter__.count\n }\n /* c8 ignore stop */\n if (listeners.length === count) {\n this.unload()\n const ret = this.#emitter.emit('exit', null, sig)\n /* c8 ignore start */\n const s = sig === 'SIGHUP' ? this.#hupSig : sig\n if (!ret) process.kill(process.pid, s)\n /* c8 ignore stop */\n }\n }\n }\n\n this.#originalProcessReallyExit = process.reallyExit\n this.#originalProcessEmit = process.emit\n }\n\n onExit(cb: Handler, opts?: { alwaysLast?: boolean }) {\n /* c8 ignore start */\n if (!processOk(this.#process)) {\n return () => {}\n }\n /* c8 ignore stop */\n\n if (this.#loaded === false) {\n this.load()\n }\n\n const ev = opts?.alwaysLast ? 'afterExit' : 'exit'\n this.#emitter.on(ev, cb)\n return () => {\n this.#emitter.removeListener(ev, cb)\n if (\n this.#emitter.listeners['exit'].length === 0 &&\n this.#emitter.listeners['afterExit'].length === 0\n ) {\n this.unload()\n }\n }\n }\n\n load() {\n if (this.#loaded) {\n return\n }\n this.#loaded = true\n\n // This is the number of onSignalExit's that are in play.\n // It's important so that we can count the correct number of\n // listeners on signals, and don't wait for the other one to\n // handle it instead of us.\n this.#emitter.count += 1\n\n for (const sig of signals) {\n try {\n const fn = this.#sigListeners[sig]\n if (fn) this.#process.on(sig, fn)\n } catch (_) {}\n }\n\n this.#process.emit = (ev: string, ...a: any[]) => {\n return this.#processEmit(ev, ...a)\n }\n this.#process.reallyExit = (code?: number | null | undefined) => {\n return this.#processReallyExit(code)\n }\n }\n\n unload() {\n if (!this.#loaded) {\n return\n }\n this.#loaded = false\n\n signals.forEach(sig => {\n const listener = this.#sigListeners[sig]\n /* c8 ignore start */\n if (!listener) {\n throw new Error('Listener not defined for signal: ' + sig)\n }\n /* c8 ignore stop */\n try {\n this.#process.removeListener(sig, listener)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n })\n this.#process.emit = this.#originalProcessEmit\n this.#process.reallyExit = this.#originalProcessReallyExit\n this.#emitter.count -= 1\n }\n\n #processReallyExit(code?: number | null | undefined) {\n /* c8 ignore start */\n if (!processOk(this.#process)) {\n return 0\n }\n this.#process.exitCode = code || 0\n /* c8 ignore stop */\n\n this.#emitter.emit('exit', this.#process.exitCode, null)\n return this.#originalProcessReallyExit.call(\n this.#process,\n this.#process.exitCode\n )\n }\n\n #processEmit(ev: string, ...args: any[]): any {\n const og = this.#originalProcessEmit\n if (ev === 'exit' && processOk(this.#process)) {\n if (typeof args[0] === 'number') {\n this.#process.exitCode = args[0]\n /* c8 ignore start */\n }\n /* c8 ignore start */\n const ret = og.call(this.#process, ev, ...args)\n /* c8 ignore start */\n this.#emitter.emit('exit', this.#process.exitCode, null)\n /* c8 ignore stop */\n return ret\n } else {\n return og.call(this.#process, ev, ...args)\n }\n }\n}\n\nconst process = globalThis.process\n// wrap so that we call the method on the actual handler, without\n// exporting it directly.\nexport const {\n /**\n * Called when the process is exiting, whether via signal, explicit\n * exit, or running out of stuff to do.\n *\n * If the global process object is not suitable for instrumentation,\n * then this will be a no-op.\n *\n * Returns a function that may be used to unload signal-exit.\n */\n onExit,\n\n /**\n * Load the listeners. Likely you never need to call this, unless\n * doing a rather deep integration with signal-exit functionality.\n * Mostly exposed for the benefit of testing.\n *\n * @internal\n */\n load,\n\n /**\n * Unload the listeners. Likely you never need to call this, unless\n * doing a rather deep integration with signal-exit functionality.\n * Mostly exposed for the benefit of testing.\n *\n * @internal\n */\n unload,\n} = signalExitWrap(\n processOk(process) ? new SignalExit(process) : new SignalExitFallback()\n)\n", "import {\n ChildProcessByStdio,\n SendHandle,\n Serializable,\n spawn as nodeSpawn,\n SpawnOptions,\n ChildProcess,\n} from 'child_process'\nimport crossSpawn from 'cross-spawn'\nimport { onExit } from 'signal-exit'\nimport { proxySignals } from './proxy-signals.js'\nimport { watchdog } from './watchdog.js'\n\n/* c8 ignore start */\nconst spawn = process?.platform === 'win32' ? crossSpawn : nodeSpawn\n/* c8 ignore stop */\n\n/**\n * The signature for the cleanup method.\n *\n * Arguments indicate the exit status of the child process.\n *\n * If a Promise is returned, then the process is not terminated\n * until it resolves, and the resolution value is treated as the\n * exit status (if a number) or signal exit (if a signal string).\n *\n * If `undefined` is returned, then no change is made, and the parent\n * exits in the same way that the child exited.\n *\n * If boolean `false` is returned, then the parent's exit is canceled.\n *\n * If a number is returned, then the parent process exits with the number\n * as its exitCode.\n *\n * If a signal string is returned, then the parent process is killed with\n * the same signal that caused the child to exit.\n */\nexport type Cleanup = (\n code: number | null,\n signal: null | NodeJS.Signals,\n processInfo: {\n watchdogPid?: ChildProcess['pid']\n },\n) =>\n | void\n | undefined\n | number\n | NodeJS.Signals\n | false\n | Promise<void | undefined | number | NodeJS.Signals | false>\n\nexport type FgArgs =\n | [program: string | [cmd: string, ...args: string[]], cleanup?: Cleanup]\n | [\n program: [cmd: string, ...args: string[]],\n opts?: SpawnOptions,\n cleanup?: Cleanup,\n ]\n | [program: string, cleanup?: Cleanup]\n | [program: string, opts?: SpawnOptions, cleanup?: Cleanup]\n | [program: string, args?: string[], cleanup?: Cleanup]\n | [\n program: string,\n args?: string[],\n opts?: SpawnOptions,\n cleanup?: Cleanup,\n ]\n\n/**\n * Normalizes the arguments passed to `foregroundChild`.\n *\n * Exposed for testing.\n *\n * @internal\n */\nexport const normalizeFgArgs = (\n fgArgs: FgArgs,\n): [\n program: string,\n args: string[],\n spawnOpts: SpawnOptions,\n cleanup: Cleanup,\n] => {\n let [program, args = [], spawnOpts = {}, cleanup = () => {}] = fgArgs\n if (typeof args === 'function') {\n cleanup = args\n spawnOpts = {}\n args = []\n } else if (!!args && typeof args === 'object' && !Array.isArray(args)) {\n if (typeof spawnOpts === 'function') cleanup = spawnOpts\n spawnOpts = args\n args = []\n } else if (typeof spawnOpts === 'function') {\n cleanup = spawnOpts\n spawnOpts = {}\n }\n if (Array.isArray(program)) {\n const [pp, ...pa] = program\n program = pp\n args = pa\n }\n return [program, args, { ...spawnOpts }, cleanup]\n}\n\n/**\n * Spawn the specified program as a \"foreground\" process, or at least as\n * close as is possible given node's lack of exec-without-fork.\n *\n * Cleanup method may be used to modify or ignore the result of the child's\n * exit code or signal. If cleanup returns undefined (or a Promise that\n * resolves to undefined), then the parent will exit in the same way that\n * the child did.\n *\n * Return boolean `false` to prevent the parent's exit entirely.\n */\nexport function foregroundChild(\n cmd: string | [cmd: string, ...args: string[]],\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n program: string,\n args?: string[],\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n program: string,\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n program: string,\n args?: string[],\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n ...fgArgs: FgArgs\n): ChildProcessByStdio<null, null, null> {\n const [program, args, spawnOpts, cleanup] = normalizeFgArgs(fgArgs)\n\n spawnOpts.stdio = [0, 1, 2]\n if (process.send) {\n spawnOpts.stdio.push('ipc')\n }\n\n const child = spawn(program, args, spawnOpts) as ChildProcessByStdio<\n null,\n null,\n null\n >\n\n const childHangup = () => {\n try {\n child.kill('SIGHUP')\n\n /* c8 ignore start */\n } catch (_) {\n // SIGHUP is weird on windows\n child.kill('SIGTERM')\n }\n /* c8 ignore stop */\n }\n const removeOnExit = onExit(childHangup)\n\n proxySignals(child)\n const dog = watchdog(child)\n\n let done = false\n child.on('close', async (code, signal) => {\n /* c8 ignore start */\n if (done) return\n /* c8 ignore stop */\n done = true\n const result = cleanup(code, signal, {\n watchdogPid: dog.pid,\n })\n const res = isPromise(result) ? await result : result\n removeOnExit()\n\n if (res === false) return\n else if (typeof res === 'string') {\n signal = res\n code = null\n } else if (typeof res === 'number') {\n code = res\n signal = null\n }\n\n if (signal) {\n // If there is nothing else keeping the event loop alive,\n // then there's a race between a graceful exit and getting\n // the signal to this process. Put this timeout here to\n // make sure we're still alive to get the signal, and thus\n // exit with the intended signal code.\n /* istanbul ignore next */\n setTimeout(() => {}, 2000)\n try {\n process.kill(process.pid, signal)\n /* c8 ignore start */\n } catch (_) {\n process.kill(process.pid, 'SIGTERM')\n }\n /* c8 ignore stop */\n } else {\n process.exit(code || 0)\n }\n })\n\n if (process.send) {\n process.removeAllListeners('message')\n\n child.on('message', (message, sendHandle) => {\n process.send?.(message, sendHandle)\n })\n\n process.on('message', (message, sendHandle) => {\n child.send(\n message as Serializable,\n sendHandle as SendHandle | undefined,\n )\n })\n }\n\n return child\n}\n\nconst isPromise = (o: any): o is Promise<any> =>\n !!o && typeof o === 'object' && typeof o.then === 'function'\n", "import constants from 'node:constants'\nexport const allSignals =\n // this is the full list of signals that Node will let us do anything with\n Object.keys(constants).filter(\n k =>\n k.startsWith('SIG') &&\n // https://github.com/tapjs/signal-exit/issues/21\n k !== 'SIGPROF' &&\n // no sense trying to listen for SIGKILL, it's impossible\n k !== 'SIGKILL',\n ) as NodeJS.Signals[]\n\n// These are some obscure signals that are reported by kill -l\n// on macOS, Linux, or Windows, but which don't have any mapping\n// in Node.js. No sense trying if they're just going to throw\n// every time on every platform.\n//\n// 'SIGEMT',\n// 'SIGLOST',\n// 'SIGPOLL',\n// 'SIGRTMAX',\n// 'SIGRTMAX-1',\n// 'SIGRTMAX-10',\n// 'SIGRTMAX-11',\n// 'SIGRTMAX-12',\n// 'SIGRTMAX-13',\n// 'SIGRTMAX-14',\n// 'SIGRTMAX-15',\n// 'SIGRTMAX-2',\n// 'SIGRTMAX-3',\n// 'SIGRTMAX-4',\n// 'SIGRTMAX-5',\n// 'SIGRTMAX-6',\n// 'SIGRTMAX-7',\n// 'SIGRTMAX-8',\n// 'SIGRTMAX-9',\n// 'SIGRTMIN',\n// 'SIGRTMIN+1',\n// 'SIGRTMIN+10',\n// 'SIGRTMIN+11',\n// 'SIGRTMIN+12',\n// 'SIGRTMIN+13',\n// 'SIGRTMIN+14',\n// 'SIGRTMIN+15',\n// 'SIGRTMIN+16',\n// 'SIGRTMIN+2',\n// 'SIGRTMIN+3',\n// 'SIGRTMIN+4',\n// 'SIGRTMIN+5',\n// 'SIGRTMIN+6',\n// 'SIGRTMIN+7',\n// 'SIGRTMIN+8',\n// 'SIGRTMIN+9',\n// 'SIGSTKFLT',\n// 'SIGUNUSED',\n", "import { type ChildProcess } from 'child_process'\nimport { allSignals } from './all-signals.js'\n\n/**\n * Starts forwarding signals to `child` through `parent`.\n */\nexport const proxySignals = (child: ChildProcess) => {\n const listeners = new Map()\n\n for (const sig of allSignals) {\n const listener = () => {\n // some signals can only be received, not sent\n try {\n child.kill(sig)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n }\n try {\n // if it's a signal this system doesn't recognize, skip it\n process.on(sig, listener)\n listeners.set(sig, listener)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n }\n\n const unproxy = () => {\n for (const [sig, listener] of listeners) {\n process.removeListener(sig, listener)\n }\n }\n child.on('exit', unproxy)\n return unproxy\n}\n", "// this spawns a child process that listens for SIGHUP when the\n// parent process exits, and after 200ms, sends a SIGKILL to the\n// child, in case it did not terminate.\n\nimport { ChildProcess, spawn } from 'child_process'\n\nconst watchdogCode = String.raw`\nconst pid = parseInt(process.argv[1], 10)\nprocess.title = 'node (foreground-child watchdog pid=' + pid + ')'\nif (!isNaN(pid)) {\n let barked = false\n // keepalive\n const interval = setInterval(() => {}, 60000)\n const bark = () => {\n clearInterval(interval)\n if (barked) return\n barked = true\n process.removeListener('SIGHUP', bark)\n setTimeout(() => {\n try {\n process.kill(pid, 'SIGKILL')\n setTimeout(() => process.exit(), 200)\n } catch (_) {}\n }, 500)\n })\n process.on('SIGHUP', bark)\n}\n`\n\n/**\n * Pass in a ChildProcess, and this will spawn a watchdog process that\n * will make sure it exits if the parent does, thus preventing any\n * dangling detached zombie processes.\n *\n * If the child ends before the parent, then the watchdog will terminate.\n */\nexport const watchdog = (child: ChildProcess) => {\n let dogExited = false\n const dog = spawn(\n process.execPath,\n ['-e', watchdogCode, String(child.pid)],\n {\n stdio: 'ignore',\n },\n )\n dog.on('exit', () => (dogExited = true))\n child.on('exit', () => {\n if (!dogExited) dog.kill('SIGKILL')\n })\n return dog\n}\n", "import { error } from '@vltpkg/error-cause'\nimport { PackageJson } from '@vltpkg/package-json'\nimport type {\n PromiseSpawnOptions,\n SpawnResultNoStdio,\n SpawnResultStdioStrings,\n} from '@vltpkg/promise-spawn'\nimport { promiseSpawn } from '@vltpkg/promise-spawn'\nimport type { Manifest } from '@vltpkg/types'\nimport { foregroundChild } from 'foreground-child'\nimport { proxySignals } from 'foreground-child/proxy-signals'\nimport { statSync } from 'node:fs'\nimport { delimiter, resolve, sep } from 'node:path'\nimport { walkUp } from 'walk-up-path'\nimport {\n getNodeGypShimDir,\n hasNodeGypReference,\n} from './aliasRunner.ts'\n\n/** map of which node_modules/.bin folders exist */\nconst dotBins = new Map<string, boolean>()\n\n/** Check if a directory exists, and cache result */\nconst dirExists = (p: string) => {\n const cached = dotBins.get(p)\n if (cached !== undefined) return cached\n try {\n const isDir = statSync(p).isDirectory()\n dotBins.set(p, isDir)\n return isDir\n } catch {\n dotBins.set(p, false)\n return false\n }\n}\n\nconst nmBin = `${sep}node_modules${sep}.bin`\n\n/**\n * Add all existing `node_modules/.bin` folders to the PATH that\n * exist between the cwd and the projectRoot, so dependency bins\n * are found, with closer paths higher priority.\n *\n * If command contains node-gyp reference, also inject the shim directory\n * as a fallback (after all existing PATH entries).\n */\nconst addPaths = async (\n projectRoot: string,\n cwd: string,\n env: NodeJS.ProcessEnv,\n command?: string,\n): Promise<NodeJS.ProcessEnv> => {\n const { PATH = '' } = env\n const PATHsplit = PATH.split(delimiter)\n const paths = new Set<string>()\n\n // anything in the PATH that already has node_modules/.bin is a thing\n // we put there, perhaps for the vlx exec cache usage\n for (const p of PATHsplit) {\n if (p.endsWith(nmBin)) {\n paths.add(p)\n }\n }\n for (const p of walkUp(cwd)) {\n const dotBin = resolve(p, 'node_modules/.bin')\n if (dirExists(dotBin)) paths.add(dotBin)\n if (p === projectRoot) break\n }\n for (const p of PATH.split(delimiter)) {\n /* c8 ignore next - pretty rare to have an empty entry */\n if (p) paths.add(p)\n }\n\n // If command has node-gyp, inject shim directory as fallback (last)\n if (command && hasNodeGypReference(command)) {\n try {\n const shimDir = await getNodeGypShimDir()\n paths.add(shimDir)\n /* c8 ignore start */\n } catch {\n // Ignore shim creation errors, command will fail naturally if node-gyp is needed\n }\n /* c8 ignore stop */\n }\n\n env.PATH = [...paths].join(delimiter)\n return env\n}\n\n/** options shared by run() and exec() */\nexport type SharedOptions = PromiseSpawnOptions & {\n /** additional arguments to pass to the command */\n args?: string[]\n /** the root of the project, which we don't walk up past */\n projectRoot: string\n\n /** the directory where the package.json lives and the script runs */\n cwd: string\n /**\n * environment variables to set. `process.env` is always included,\n * to omit fields, set them explicitly to undefined.\n *\n * vlt will add some of its own, as well:\n * - npm_lifecycle_event: the event name\n * - npm_lifecycle_script: the command in package.json#scripts\n * - npm_package_json: path to the package.json file\n * - VLT_* envs for all vlt configuration values that are set\n */\n env?: NodeJS.ProcessEnv\n /**\n * the shell to run the script in. If not set, then the default\n * platform-specific shell will be used.\n */\n 'script-shell'?: boolean | string\n\n /**\n * If true, then `FORCE_COLOR=1` will be set in the environment so that\n * scripts will typically have colored output enablled, even if the output\n * is not a tty.\n */\n color?: boolean\n}\n\n/**\n * Options for run() and runFG()\n */\nexport type RunOptions = SharedOptions & {\n /** the name of the thing in package.json#scripts */\n arg0: string\n /**\n * pass in a @vltpkg/package-json.PackageJson instance, and\n * it'll be used for reading the package.json file. Optional,\n * may improve performance somewhat.\n */\n packageJson?: PackageJson\n\n /**\n * Pass in a manifest to avoid having to read it at all\n */\n manifest?: Pick<Manifest, 'scripts' | 'gypfile'>\n\n /**\n * if the script is not defined in package.json#scripts, just ignore it and\n * treat as success. Otherwise, treat as an error. Default false.\n */\n ignoreMissing?: boolean\n\n /**\n * skip the pre/post commands, just run the one specified.\n * This can be used to run JUST the specified script, without any\n * pre/post commands.\n */\n ignorePrePost?: boolean\n}\n\n/**\n * Options for exec() and execFG()\n */\nexport type ExecOptions = SharedOptions & {\n /** the command to execute */\n arg0: string\n}\n\n/**\n * Options for runExec() and runExecFG()\n */\nexport type RunExecOptions = SharedOptions & {\n /**\n * Either the command to be executed, or the event to be run\n */\n arg0: string\n /**\n * pass in a @vltpkg/package-json.PackageJson instance, and\n * it'll be used for reading the package.json file. Optional,\n * may improve performance somewhat.\n */\n packageJson?: PackageJson\n}\n\n/**\n * Run a package.json#scripts event in the background\n */\nexport const run = async (options: RunOptions): Promise<RunResult> =>\n runImpl(options, exec, '')\n\n/**\n * Run a package.json#scripts event in the foreground\n */\nexport const runFG = async (\n options: RunOptions,\n): Promise<RunFGResult> => runImpl(options, execFG, null)\n\n/** Return type of {@link run} */\nexport type RunResult = SpawnResultStdioStrings & {\n pre?: SpawnResultStdioStrings\n post?: SpawnResultStdioStrings\n}\n\n/** Return type of {@link runFG} */\nexport type RunFGResult = SpawnResultNoStdio & {\n pre?: SpawnResultNoStdio\n post?: SpawnResultNoStdio\n}\n\nexport const isRunResult = (v: unknown): v is RunResult =>\n !!v &&\n typeof v === 'object' &&\n !Array.isArray(v) &&\n 'stdout' in v &&\n 'stderr' in v &&\n 'status' in v &&\n 'signal' in v\n\n/**\n * Return type of {@link run} or {@link runFG}, as determined by their base\n * type\n * @internal\n */\nexport type RunImplResult<\n R extends SpawnResultNoStdio | SpawnResultStdioStrings,\n> = R & { pre?: R; post?: R }\n\n/**\n * Internal implementation of run() and runFG(), since they're mostly identical\n */\nconst runImpl = async <\n R extends SpawnResultNoStdio | SpawnResultStdioStrings,\n>(\n options: RunOptions,\n execImpl: (options: ExecOptions) => Promise<R>,\n empty: R['stdout'],\n): Promise<RunImplResult<R>> => {\n const {\n arg0,\n packageJson = new PackageJson(),\n ignoreMissing = false,\n manifest,\n 'script-shell': shell = true,\n ...execArgs\n } = options\n const pjPath = resolve(options.cwd, 'package.json')\n // npm adds a `\"install\": \"node-gyp rebuild\"` if a binding.gyp\n // is present at the time of publish, EVEN IF it's not included\n // in the package. So, we need to read the actual package.json\n // in those cases.\n const untrustworthy = !!(\n manifest?.gypfile &&\n arg0 === 'install' &&\n manifest.scripts?.install === 'node-gyp rebuild'\n )\n const pj =\n (untrustworthy ? undefined : manifest) ??\n packageJson.read(options.cwd)\n const { scripts } = pj\n let command = scripts?.[arg0]\n\n // npm's implicit install behavior: \"If there is a binding.gyp file in the\n // root of your package and you haven't defined your own install or preinstall\n // scripts, npm will default the install command to compile using node-gyp\n // via node-gyp rebuild\"\n if (!command && arg0 === 'install') {\n const hasNoInstallScripts =\n !scripts?.install && !scripts?.preinstall\n if (hasNoInstallScripts) {\n try {\n const bindingGypPath = resolve(options.cwd, 'binding.gyp')\n const hasBindingGyp = statSync(bindingGypPath).isFile()\n if (hasBindingGyp) {\n command = 'node-gyp rebuild'\n }\n } catch {\n // binding.gyp doesn't exist, that's fine\n }\n }\n }\n\n if (!command) {\n if (ignoreMissing) {\n return {\n command: '',\n /* c8 ignore next */\n args: execArgs.args ?? [],\n cwd: options.cwd,\n status: 0,\n signal: null,\n stdout: empty,\n stderr: empty,\n // `as` to workaround \"could be instantiated with arbitrary type\".\n // it's private and used in 2 places, we know that it isn't.\n } as R\n }\n throw error('Script not defined in package.json', {\n name: arg0,\n cwd: options.cwd,\n args: options.args,\n path: pjPath,\n manifest: pj,\n })\n }\n\n const precommand = !options.ignorePrePost && scripts?.[`pre${arg0}`]\n const pre =\n precommand ?\n await execImpl({\n arg0: precommand,\n ...execArgs,\n 'script-shell': shell,\n args: [],\n env: {\n ...execArgs.env,\n npm_package_json: pjPath,\n npm_lifecycle_event: `pre${arg0}`,\n npm_lifecycle_script: precommand,\n },\n })\n : undefined\n if (pre && (pre.status || pre.signal)) {\n return pre as RunImplResult<R>\n }\n const result: RunImplResult<R> = await execImpl({\n arg0: command,\n ...execArgs,\n 'script-shell': shell,\n env: {\n ...execArgs.env,\n npm_package_json: pjPath,\n npm_lifecycle_event: arg0,\n npm_lifecycle_script: command,\n },\n })\n result.pre = pre\n if (result.signal || result.status) {\n return result\n }\n\n const postcommand =\n !options.ignorePrePost && scripts?.[`post${arg0}`]\n if (!postcommand) return result\n\n const post = await execImpl({\n arg0: postcommand,\n ...execArgs,\n 'script-shell': shell,\n args: [],\n env: {\n ...execArgs.env,\n npm_package_json: pjPath,\n npm_lifecycle_event: `post${arg0}`,\n npm_lifecycle_script: postcommand,\n },\n })\n\n if (post.status || post.signal) {\n const { status, signal } = post\n return Object.assign(result, { post, status, signal })\n }\n result.post = post\n return result\n}\n\n/**\n * Execute an arbitrary command in the background\n */\nexport const exec = async (\n options: ExecOptions,\n): Promise<SpawnResultStdioStrings> => {\n const {\n arg0,\n args = [],\n cwd,\n env = {},\n projectRoot,\n 'script-shell': shell = false,\n color = false,\n signal,\n ...spawnOptions\n } = options\n\n const p = promiseSpawn(arg0, args, {\n ...spawnOptions,\n shell,\n stdio: 'pipe',\n stdioString: true,\n cwd,\n env: await addPaths(\n projectRoot,\n cwd,\n {\n ...process.env,\n ...env,\n FORCE_COLOR: color ? '1' : '0',\n },\n arg0,\n ),\n windowsHide: true,\n })\n proxySignals(p.process)\n return await p\n}\n\n/**\n * Execute an arbitrary command in the foreground\n */\nexport const execFG = async (\n options: ExecOptions,\n): Promise<SpawnResultNoStdio> => {\n const {\n arg0,\n args = [],\n cwd,\n projectRoot,\n env = {},\n 'script-shell': shell = false,\n color = true,\n signal,\n ...spawnOptions\n } = options\n\n const processEnv = await addPaths(\n projectRoot,\n cwd,\n {\n ...process.env,\n ...env,\n FORCE_COLOR: color ? '1' : '0',\n },\n arg0,\n )\n\n return new Promise<SpawnResultNoStdio>(res => {\n foregroundChild(\n arg0,\n args,\n {\n ...spawnOptions,\n shell,\n cwd,\n env: processEnv,\n },\n (status, signal) => {\n res({\n command: arg0,\n args,\n cwd,\n stdout: null,\n stderr: null,\n status,\n signal,\n })\n return false\n },\n )\n })\n}\n\nconst runExecImpl = async <\n R extends SpawnResultNoStdio | SpawnResultStdioStrings,\n>(\n options: RunExecOptions,\n runImpl: (options: RunOptions) => Promise<RunImplResult<R>>,\n execImpl: (options: ExecOptions) => Promise<R>,\n): Promise<R | RunImplResult<R>> => {\n const { arg0, packageJson = new PackageJson(), ...args } = options\n const pj = packageJson.read(options.cwd)\n const { scripts } = pj\n const command = scripts?.[arg0]\n if (command) {\n return runImpl({ ...args, packageJson, arg0 })\n } else {\n return execImpl({ ...args, arg0 })\n }\n}\n\n/**\n * If the arg0 is a defined package.json script, then run(), otherwise exec()\n */\nexport const runExec = async (\n options: RunExecOptions,\n): Promise<RunResult | SpawnResultStdioStrings> =>\n runExecImpl<SpawnResultStdioStrings>(options, run, exec)\n\n/**\n * If the arg0 is a defined package.json script, then runFG(), otherwise\n * execFG()\n */\nexport const runExecFG = async (\n options: RunExecOptions,\n): Promise<RunFGResult | SpawnResultNoStdio> =>\n runExecImpl<SpawnResultNoStdio>(options, runFG, execFG)\n\n// Export shim utilities\nexport {\n getNodeGypShim,\n getNodeGypShimDir,\n hasNodeGypReference,\n} from './aliasRunner.ts'\n", "import { XDG } from '@vltpkg/xdg'\nimport { chmod, mkdir, stat, writeFile } from 'node:fs/promises'\nimport { dirname, join } from 'node:path'\n\nconst xdg = new XDG('vlt')\nlet shimPath: string | undefined\n\n/**\n * Get or create the node-gyp shim file path\n * The shim redirects node-gyp calls to vlx node-gyp@latest\n */\nexport async function getNodeGypShim(): Promise<string> {\n if (shimPath) return shimPath\n\n const runtimeDir = xdg.runtime('run')\n const shimFile = join(runtimeDir, 'node-gyp')\n\n // Check if shim already exists\n try {\n await stat(shimFile)\n /* c8 ignore next 2 - hard to test */\n shimPath = shimFile\n return shimPath\n } catch {\n // Shim doesn't exist, create it\n }\n\n // Create runtime directory if needed\n await mkdir(runtimeDir, { recursive: true })\n\n // Create shim that calls vlx\n /* c8 ignore start - ignore platform-dependent coverage */\n const shimContent =\n process.platform === 'win32' ?\n `@echo off\\nvlx --yes node-gyp@latest %*\\n`\n : `#!/bin/sh\\nexec vlx --yes node-gyp@latest \"$@\"\\n`\n /* c8 ignore stop */\n\n await writeFile(shimFile, shimContent, 'utf8')\n\n // Make executable on Unix systems\n /* c8 ignore start - unix-only */\n if (process.platform !== 'win32') {\n await chmod(shimFile, 0o755)\n }\n /* c8 ignore stop */\n\n shimPath = shimFile\n return shimPath\n}\n\n/**\n * Get the directory containing the node-gyp shim\n * This can be prepended to PATH to make the shim available\n */\nexport async function getNodeGypShimDir(): Promise<string> {\n const shim = await getNodeGypShim()\n return dirname(shim)\n}\n\n/**\n * Check if a command contains node-gyp references\n */\nexport function hasNodeGypReference(command: string): boolean {\n return command.includes('node-gyp')\n}\n", "import postcssSelectorParser from 'postcss-selector-parser'\nimport type { Pseudo, Root } from 'postcss-selector-parser'\nimport {\n asSelectorNode,\n isCombinatorNode,\n isPseudoNode,\n isTagNode,\n} from './types.ts'\nimport type { PostcssNode } from './types.ts'\n\nexport * from './types.ts'\n\n/**\n * Escapes forward slashes in specific patterns matching @scoped/name paths\n * This will allow usage of unescaped forward slashes necessary for scoped\n * package names in the id selector.\n */\nexport const escapeScopedNamesSlashes = (query: string): string =>\n query.replace(\n /(#@(\\w|-|\\.)+)\\//gm,\n (_, scope: string) => `${scope}\\\\/`,\n )\n\nexport const escapeDots = (query: string): string =>\n query.replaceAll('.', '\\\\.')\n\nexport const unescapeDots = (query: string): string =>\n query.replaceAll('\\\\.', '.')\n\nconst pseudoCleanUpNeeded = new Set([\n ':published',\n ':score',\n ':malware',\n ':severity',\n ':sev',\n ':squat',\n ':semver',\n ':v',\n])\n\nconst hasParamsToEscape = (node: Pseudo) =>\n pseudoCleanUpNeeded.has(node.value)\n\n/**\n * Parses a CSS selector string into an AST\n * Handles escaping of forward slashes in specific patterns\n */\nexport const parse = (query: string): Root => {\n const escapedQuery = escapeDots(escapeScopedNamesSlashes(query))\n const transformAst = (root: Root) => {\n root.walk((node: PostcssNode) => {\n // clean up the escaped dots\n if (node.value && typeof node.value === 'string') {\n node.value = unescapeDots(node.value)\n }\n if (isPseudoNode(node) && hasParamsToEscape(node)) {\n // these are pseudo nodes that should only take strings as\n // parameters, so in this preparse step we clean up anything\n // that was recognized as a postcss node and transform that\n // into something that can be most likely parsed as a string\n for (const n of node.nodes) {\n // the parameters have a selector node that wraps them up\n const selector = asSelectorNode(n)\n selector.nodes.forEach((currentNode, index, arr) => {\n // get the next node, we'll update it later\n const nextNode = arr[index + 1]\n // if the current node is a combinator node, we'll need to\n // escape it, we do so by removing the node entirely and\n // updating the contents of the next node with its value\n if (\n isCombinatorNode(currentNode) &&\n isTagNode(nextNode)\n ) {\n nextNode.value = `${currentNode.spaces.before}${currentNode.value}${currentNode.spaces.after}${nextNode.value}`\n // make sure to also update the source position\n // references, those are used by the syntax highlighter\n if (\n nextNode.source?.start?.line &&\n currentNode.source?.start?.line\n ) {\n nextNode.source.start.line =\n currentNode.source.start.line\n }\n if (\n nextNode.source?.start?.column &&\n currentNode.source?.start?.column\n ) {\n nextNode.source.start.column =\n currentNode.source.start.column\n }\n // removes the current node from the selector node\n arr.splice(index, 1)\n }\n })\n // after removing combinator nodes, if we end up with multiple\n // tags in the selector node, we need to smush them together\n selector.nodes.reduce((acc, currentNode) => {\n if (currentNode === acc) return acc\n acc.value = `${acc.value}${currentNode.spaces.before}${currentNode.value}${currentNode.spaces.after}`\n // make sure to also update the source position refs\n if (\n currentNode.source?.end?.line &&\n acc.source?.end?.line\n ) {\n acc.source.end.line = currentNode.source.end.line\n }\n if (\n currentNode.source?.end?.column &&\n acc.source?.end?.column\n ) {\n acc.source.end.column = currentNode.source.end.column\n }\n return acc\n }, selector.first)\n // the selector wrapper node should have a single node\n selector.nodes.length = 1\n }\n }\n })\n }\n return postcssSelectorParser(transformAst).astSync(escapedQuery)\n}\n", "import { error } from '@vltpkg/error-cause'\nimport type {\n Tag,\n String,\n Selector,\n Root,\n Pseudo,\n Nesting,\n Identifier,\n Comment,\n Combinator,\n ClassName,\n Attribute,\n Universal,\n tag,\n id,\n combinator,\n string,\n attribute,\n pseudo,\n} from 'postcss-selector-parser'\n\nexport type PostcssNode =\n | Tag\n | String\n | Selector\n | Root\n | Pseudo\n | Nesting\n | Identifier\n | Comment\n | Combinator\n | ClassName\n | Attribute\n | Universal\n\nexport type PostCSSLeaf =\n | ReturnType<typeof tag>\n | ReturnType<typeof id>\n | ReturnType<typeof attribute>\n | ReturnType<typeof combinator>\n | ReturnType<typeof pseudo>\n | ReturnType<typeof string>\n\nexport type PostcssNodeWithChildren = Selector | Root | Pseudo\n\nexport type ParsedSelectorToken = PostcssNode & {\n token: string\n}\n\nexport const isPostcssNodeWithChildren = (\n node: any,\n): node is PostcssNodeWithChildren =>\n 'type' in node && 'nodes' in node\n\nexport const asPostcssNodeWithChildren = (\n node?: PostcssNode,\n): PostcssNodeWithChildren => {\n if (!node) {\n throw error('Expected a query node')\n }\n\n if (!isPostcssNodeWithChildren(node)) {\n throw error('Not a query selector node with children', {\n found: node,\n })\n }\n return node\n}\n\nconst isObj = (o: unknown): o is Record<string, unknown> =>\n !!o && typeof o === 'object'\n\nexport const isAttributeNode = (node: unknown): node is Attribute =>\n isObj(node) && !!node.attribute && node.type === 'attribute'\n\nexport const asAttributeNode = (node?: PostcssNode): Attribute => {\n if (!node) {\n throw error('Expected a query node')\n }\n\n if (!isAttributeNode(node)) {\n throw error('Mismatching query node', {\n wanted: 'attribute',\n found: node.type,\n })\n }\n return node\n}\n\nexport const isCombinatorNode = (node: unknown): node is Combinator =>\n isObj(node) && !!node.value && node.type === 'combinator'\n\nexport const asCombinatorNode = (node?: PostcssNode): Combinator => {\n if (!node) {\n throw error('Expected a query node')\n }\n\n if (!isCombinatorNode(node)) {\n throw error('Mismatching query node', {\n wanted: 'combinator',\n found: node.type,\n })\n }\n return node\n}\n\nexport const isIdentifierNode = (node: any): node is Identifier =>\n isObj(node) && !!node.value && node.type === 'id'\n\nexport const asIdentifierNode = (node?: PostcssNode): Identifier => {\n if (!node) {\n throw error('Expected a query node')\n }\n\n if (!isIdentifierNode(node)) {\n throw error('Mismatching query node', {\n wanted: 'id',\n found: node.type,\n })\n }\n return node\n}\n\nexport const isSelectorNode = (node: any): node is Selector =>\n isPostcssNodeWithChildren(node) && node.type === 'selector'\n\nexport const asSelectorNode = (node?: PostcssNode): Selector => {\n if (!node) {\n throw error('Expected a query node')\n }\n\n if (!isSelectorNode(node)) {\n throw error('Mismatching query node', {\n wanted: 'selector',\n found: node.type,\n })\n }\n return node\n}\n\nexport const isPseudoNode = (node: unknown): node is Pseudo =>\n isObj(node) && !!node.value && node.type === 'pseudo'\n\nexport const asPseudoNode = (node?: PostcssNode): Pseudo => {\n if (!node) {\n throw error('Expected a query node')\n }\n\n if (!isPseudoNode(node)) {\n throw error('Mismatching query node', {\n wanted: 'pseudo',\n found: node.type,\n })\n }\n return node\n}\n\nexport const isTagNode = (node: unknown): node is Tag =>\n isObj(node) && !!node.value && node.type === 'tag'\n\nexport const asTagNode = (node?: PostcssNode): Tag => {\n if (!node) {\n throw error('Expected a query node')\n }\n\n if (!isTagNode(node)) {\n throw error('Mismatching query node', {\n wanted: 'tag',\n found: node.type,\n })\n }\n\n return node\n}\n\nexport const isStringNode = (node: unknown): node is String =>\n isObj(node) && !!node.value && node.type === 'string'\n\nexport const asStringNode = (node?: PostcssNode): String => {\n if (!node) {\n throw error('Expected a query node')\n }\n\n if (!isStringNode(node)) {\n throw error('Mismatching query node', {\n wanted: 'string',\n found: node.type,\n })\n }\n\n return node\n}\n\nexport const isCommentNode = (node: unknown): node is Comment =>\n isObj(node) && !!node.value && node.type === 'comment'\n\nexport const asCommentNode = (node?: PostcssNode): Comment => {\n if (!node) {\n throw error('Expected a query node')\n }\n\n if (!isCommentNode(node)) {\n throw error('Mismatching query node', {\n wanted: 'comment',\n found: node.type,\n })\n }\n\n return node\n}\n", "import { error } from '@vltpkg/error-cause'\nimport type { EdgeLike, NodeLike } from '@vltpkg/types'\nimport type { ParserState } from '../types.js'\n\n/**\n * Removes a node and its incoming edges from the results.\n */\nexport const removeNode = (state: ParserState, node: NodeLike) => {\n for (const edge of node.edgesIn) {\n state.partial.edges.delete(edge)\n }\n state.partial.nodes.delete(node)\n}\n\n/**\n * Removes an edge and its outgoing node from the results.\n */\nexport const removeEdge = (state: ParserState, edge: EdgeLike) => {\n state.partial.edges.delete(edge)\n if (edge.to?.edgesIn.size === 1) {\n state.partial.nodes.delete(edge.to)\n }\n}\n\n/**\n * Removes any edges that have no destination node from the results.\n */\nexport const removeDanglingEdges = (state: ParserState) => {\n for (const edge of state.partial.edges) {\n if (!edge.to || !state.partial.nodes.has(edge.to)) {\n state.partial.edges.delete(edge)\n }\n }\n}\n\n/**\n * Removes any nodes that have no incoming edges from the results.\n */\nexport const removeUnlinkedNodes = (state: ParserState) => {\n nodeLoop: for (const node of state.partial.nodes) {\n for (const edge of state.partial.edges) {\n if (edge.to === node) {\n continue nodeLoop\n }\n }\n state.partial.nodes.delete(node)\n }\n}\n\n/**\n * Removes quotes from a string value.\n */\nexport const removeQuotes = (value: string) =>\n value.replace(/^\"(.*?)\"$/, '$1')\n\n/**\n * Asserts that the security archive is present.\n */\nexport const assertSecurityArchive: (\n state: ParserState,\n name: string,\n) => asserts state is ParserState & {\n securityArchive: NonNullable<ParserState['securityArchive']>\n} = (state, name) => {\n if (!state.securityArchive) {\n throw error(\n `Missing security archive while trying to parse the :${name} selector`,\n { found: state },\n )\n }\n}\n\n/**\n * Clears all nodes and edges from the results.\n */\nexport const clear = (state: ParserState): ParserState => {\n state.partial.nodes.clear()\n state.partial.edges.clear()\n return state\n}\n\n/**\n * Reusable security selector alert filter.\n */\nexport const createSecuritySelectorFilter = (\n name: string,\n type: string,\n) => {\n return async (state: ParserState) => {\n assertSecurityArchive(state, name)\n\n for (const node of state.partial.nodes) {\n const report = state.securityArchive.get(node.id)\n const exclude = !report?.alerts.some(\n alert => alert.type === type,\n )\n if (exclude) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n }\n}\n", "import { asAttributeNode } from '@vltpkg/dss-parser'\nimport { error } from '@vltpkg/error-cause'\nimport { removeDanglingEdges } from './pseudo/helpers.ts'\nimport type { NodeLike, JSONField, Manifest } from '@vltpkg/types'\nimport type { ParserState } from './types.ts'\n\nexport type ComparatorFn = (attr: string, value?: string) => boolean\n\n// JSONField has a mapped type constituent that would coerce to [object Object]\n// when stringified, which is what we want in this case.\n// eslint-disable-next-line @typescript-eslint/no-base-to-string\nconst jsonFieldToString = (v: JSONField) => String(v)\n\n/**\n * Retrieve the {@link Manifest} values found at the given `properties`\n * location for a given {@link Node}.\n */\nexport const getManifestPropertyValues = (\n node: NodeLike,\n properties: string[],\n attribute: string,\n): string[] | undefined => {\n if (!node.manifest) return\n\n const traverse = new Set<JSONField>([node.manifest as JSONField])\n const props = new Set<JSONField>()\n for (const key of properties) {\n for (const prop of traverse) {\n /* c8 ignore start - should be impossible */\n if (!prop) {\n throw error('failed to find nested property in :attr', {\n found: properties,\n })\n }\n /* c8 ignore stop */\n\n // expand the result list to include nested array values\n if (Array.isArray(prop)) {\n for (const p of prop) {\n traverse.add(p)\n }\n continue\n }\n\n // guard for inspecting keys of objects next\n if (\n typeof prop === 'string' ||\n typeof prop === 'number' ||\n typeof prop === 'boolean'\n ) {\n continue\n }\n\n // assign next value when found\n if (key in prop) {\n const nextValue = prop[key]\n if (nextValue) {\n if (key === attribute) {\n props.add(nextValue)\n } else {\n traverse.delete(prop)\n traverse.add(nextValue)\n }\n }\n }\n }\n }\n // if no value was found after trying a given key\n // then there's nothing to be collected\n if (!props.size) return\n\n // expand the result to include array values\n const collect = new Set<string>()\n for (const prop of props) {\n if (Array.isArray(prop)) {\n for (const p of prop) {\n collect.add(p ? jsonFieldToString(p) : '')\n }\n } else {\n collect.add(jsonFieldToString(prop))\n }\n }\n\n return [...collect]\n}\n\n// decorator style of function that will filter `ParserState` results\n// based on a provided `comparator` function\nexport const filterAttributes = (\n state: ParserState,\n comparator: ComparatorFn | undefined,\n value: string,\n propertyName: string,\n insensitive: boolean,\n prefixProperties: string[] = [],\n): ParserState => {\n const check = (attr: JSONField) =>\n comparator?.(\n insensitive ?\n jsonFieldToString(attr).toLowerCase()\n : jsonFieldToString(attr),\n insensitive ? value.toLowerCase() : value,\n )\n const deleteNode = (node: NodeLike) => {\n for (const edge of node.edgesIn) {\n state.partial.edges.delete(edge)\n }\n state.partial.nodes.delete(node)\n }\n\n for (const node of state.partial.nodes) {\n const prefixes =\n prefixProperties.length ? prefixProperties : [propertyName]\n const attrs = getManifestPropertyValues(\n node,\n prefixes,\n propertyName,\n )\n\n // if no attribute value was found, that means the attribute won't match\n if (!attrs?.length) {\n deleteNode(node)\n continue\n }\n\n // if the node attribute value won't match, then remove the node\n if (comparator && !attrs.some(check)) {\n deleteNode(node)\n }\n }\n\n removeDanglingEdges(state)\n return state\n}\n\n// ref: https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors\nconst attributeSelectors: Record<string, ComparatorFn> = {\n '=': (attr: string, value = '') => attr === value,\n '^=': (attr: string, value = '') => attr.startsWith(value),\n '$=': (attr: string, value = '') => attr.endsWith(value),\n '~=': (attr: string, value = '') =>\n new Set<string>(attr.match(/\\w+/g)).has(value),\n '*=': (attr: string, value = '') => attr.includes(value),\n '|=': (attr: string, value = '') =>\n attr === value || attr.startsWith(`${value}-`),\n undefined: (attr: string) => !!attr,\n}\nexport const attributeSelectorsMap = new Map<string, ComparatorFn>(\n Object.entries(attributeSelectors),\n)\n\n/**\n * Parse attributes selectors, e.g: `[name]`, `[name=value]`, etc\n */\nexport const attribute = async (\n state: ParserState,\n): Promise<ParserState> => {\n await state.cancellable()\n\n const curr = asAttributeNode(state.current)\n const operatorFn = attributeSelectorsMap.get(String(curr.operator))\n if (!operatorFn) {\n if (state.loose) {\n return state\n }\n\n throw error(`Unsupported attribute operator: ${curr.operator}`, {\n found: state.current,\n })\n }\n\n const value = curr.value || ''\n const propertyName = curr.attribute\n const insensitive = !!curr.insensitive\n\n // Increment the commonCounter for specificity\n state.specificity.commonCounter += 1\n\n return filterAttributes(\n state,\n operatorFn,\n value,\n propertyName,\n insensitive,\n )\n}\n", "import { asCombinatorNode } from '@vltpkg/dss-parser'\nimport { error } from '@vltpkg/error-cause'\nimport type { EdgeLike, NodeLike } from '@vltpkg/types'\nimport type { ParserState, ParserFn } from './types.ts'\n\n/**\n * Returns a new set of nodes, containing all direct dependencies\n * of the current list of nodes used.\n *\n * ref: https://developer.mozilla.org/en-US/docs/Web/CSS/Child_combinator\n */\nconst childCombinator = async (state: ParserState) => {\n const traverse = new Set(state.partial.nodes)\n state.partial.edges.clear()\n state.partial.nodes.clear()\n\n // visit direct children of the current list of nodes\n // collecting refs to these children and the edges that\n // connected them.\n for (const node of traverse) {\n for (const edge of node.edgesOut.values()) {\n if (edge.to) {\n state.partial.edges.add(edge)\n state.partial.nodes.add(edge.to)\n }\n }\n }\n\n return state\n}\n\n/**\n * Returns a new set of nodes, containing nodes that are also children\n * of all parent nodes to the current list of nodes used.\n *\n * Note: The subsequent-sibling comparator has a behavior that is\n * somehow approximative of that of its css counterpart, given that\n * in the context of dependency graphs the order of appearance is\n * not necessarily controlled by the end user. The approach for\n * this comparator is to match all siblings of a node.\n *\n * ref: https://developer.mozilla.org/en-US/docs/Web/CSS/Subsequent-sibling_combinator\n */\nconst subsequentSiblingCombinator = async (state: ParserState) => {\n const traverse = new Set(state.partial.nodes)\n state.partial.edges.clear()\n state.partial.nodes.clear()\n\n // visits direct parents of the current list of node and then\n // visit their children, collecting refs to all children and edges\n // that are not in the original list of nodes.\n for (const node of traverse) {\n for (const edge of node.edgesIn) {\n const parents: IterableIterator<EdgeLike> =\n edge.from.edgesOut.values()\n for (const edge of parents) {\n if (edge.to && edge.to !== node) {\n state.partial.edges.add(edge)\n state.partial.nodes.add(edge.to)\n }\n }\n }\n }\n\n return state\n}\n\n/**\n * Returns a new set of nodes containing all nodes that are descendents\n * to items in the current list of nodes.\n *\n * ref: https://developer.mozilla.org/en-US/docs/Web/CSS/Descendant_combinator\n */\nconst descendentCombinator = async (state: ParserState) => {\n // spaces between tags selectors are a noop\n if (state.prev?.type === 'tag' || state.next?.type === 'tag') {\n return state\n }\n\n const traverse = new Set<NodeLike>(state.partial.nodes)\n state.partial.edges.clear()\n state.partial.nodes.clear()\n\n // breadth-first traversal of the graph, starting from the current\n // list of nodes, collecting all nodes and edges along the way\n for (const node of traverse) {\n const children = new Set<NodeLike>()\n for (const edge of node.edgesOut.values()) {\n if (edge.to) {\n children.add(edge.to)\n state.partial.edges.add(edge)\n state.partial.nodes.add(edge.to)\n }\n }\n for (const child of children) {\n traverse.add(child)\n }\n }\n\n return state\n}\n\nconst combinatorSelectors = {\n '>': childCombinator,\n '~': subsequentSiblingCombinator,\n ' ': descendentCombinator,\n}\n\nconst combinatorSelectorsMap = new Map<string, ParserFn>(\n Object.entries(combinatorSelectors),\n)\n\n/**\n * Parse css-style combinators, e.g: `>`, `~` and ` `\n */\nexport const combinator = async (state: ParserState) => {\n await state.cancellable()\n\n const curr = asCombinatorNode(state.current)\n const parserFn =\n curr.value && combinatorSelectorsMap.get(curr.value)\n if (!parserFn) {\n if (state.loose) {\n return state\n }\n\n throw error(`Unsupported combinator: ${state.current.value}`, {\n found: state.current,\n })\n }\n return parserFn(state)\n}\n", "import { asIdentifierNode } from '@vltpkg/dss-parser'\nimport { error } from '@vltpkg/error-cause'\nimport type { ParserState } from './types.ts'\n\n/**\n * Parse ids, e.g: `#foo`\n */\nexport const id = async (\n state: ParserState,\n): Promise<ParserState> => {\n const { value } = asIdentifierNode(state.current)\n\n /* c8 ignore start - should not be possible */\n if (!value) {\n throw error('Missing identifier name')\n }\n /* c8 ignore stop */\n\n // Filter out any edges and their linked\n // nodes if they don't match the id value\n for (const edge of state.partial.edges) {\n if (edge.name !== value) {\n state.partial.edges.delete(edge)\n if (edge.to) {\n state.partial.nodes.delete(edge.to)\n }\n }\n }\n\n // Filter out importer nodes, this extra step is needed\n // to filter out nodes that have no edges linking to them\n for (const node of state.partial.nodes) {\n if (\n node.edgesIn.size === 0 &&\n node.name !== value &&\n state.partial.nodes.has(node)\n ) {\n state.partial.nodes.delete(node)\n }\n }\n\n // Increment the idCounter for specificity\n state.specificity.idCounter += 1\n\n return state\n}\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **missingAuthor** report alert.\n */\nexport const abandoned = createSecuritySelectorFilter(\n 'abandoned',\n 'missingAuthor',\n)\n", "import { error } from '@vltpkg/error-cause'\nimport {\n asAttributeNode,\n asPostcssNodeWithChildren,\n asStringNode,\n asTagNode,\n isStringNode,\n} from '@vltpkg/dss-parser'\nimport {\n attributeSelectorsMap,\n filterAttributes,\n} from '../attribute.ts'\nimport { removeQuotes } from './helpers.ts'\nimport type { ParserState } from '../types.ts'\nimport type { PostcssNode } from '@vltpkg/dss-parser'\n\nexport type AttrInternals = {\n attribute: string\n insensitive: boolean\n operator?: string\n value?: string\n properties: string[]\n}\n\n/**\n * Parses the internal / nested selectors of a `:attr` selector.\n */\nexport const parseInternals = (\n nodes: PostcssNode[],\n): AttrInternals => {\n // the last part is the attribute selector\n const attributeSelector = asAttributeNode(\n asPostcssNodeWithChildren(nodes.pop()).nodes[0],\n )\n // all preppending selectors are naming nested properties\n const properties: string[] = []\n for (const selector of nodes) {\n const selectorNode = asPostcssNodeWithChildren(selector).nodes[0]\n // Handle both quoted string and tag nodes\n if (isStringNode(selectorNode)) {\n properties.push(removeQuotes(asStringNode(selectorNode).value))\n } else {\n properties.push(asTagNode(selectorNode).value)\n }\n }\n // include the attribute selector as the last part of the property lookup\n properties.push(attributeSelector.attribute)\n\n return {\n attribute: attributeSelector.attribute,\n insensitive: attributeSelector.insensitive || false,\n operator: attributeSelector.operator,\n value: attributeSelector.value,\n properties,\n }\n}\n\n/**\n * :attr Pseudo-Selector, allows for retrieving nodes based on nested\n * properties of the `package.json` metadata.\n */\nexport const attr = async (state: ParserState) => {\n // Parses and retrieves the values for the nested selectors\n let internals\n try {\n internals = parseInternals(\n asPostcssNodeWithChildren(state.current).nodes,\n )\n } catch (err) {\n throw error('Failed to parse :attr selector', {\n cause: err,\n })\n }\n\n // reuses the attribute selector logic to filter the nodes\n const comparator =\n internals.operator ?\n attributeSelectorsMap.get(internals.operator)\n : undefined\n const value = internals.value || ''\n const propertyName = internals.attribute\n const insensitive = internals.insensitive\n const prefixProperties = internals.properties\n return filterAttributes(\n state,\n comparator,\n value,\n propertyName,\n insensitive,\n prefixProperties,\n )\n}\n", "import type { ParserState } from '../types.ts'\nimport { removeNode, removeDanglingEdges } from './helpers.ts'\n\n/**\n * :built Pseudo-Selector will only match packages that have\n * a `buildState` property set to 'built', indicating they have\n * been successfully built during the reify process.\n */\nexport const built = async (state: ParserState) => {\n for (const node of state.partial.nodes) {\n if (node.buildState !== 'built') {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n", "import type { ParserState } from '../types.js'\nimport {\n assertSecurityArchive,\n removeDanglingEdges,\n removeNode,\n} from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **manifestConfusion** report alert.\n * Also includes any node that has been marked as **confused**.\n */\nexport const confused = async (state: ParserState) => {\n assertSecurityArchive(state, 'confused')\n\n for (const node of state.partial.nodes) {\n const report = state.securityArchive.get(node.id)\n const exclude =\n !node.confused &&\n !report?.alerts.some(\n alert => alert.type === 'manifestConfusion',\n )\n if (exclude) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n return state\n}\n", "import { error } from '@vltpkg/error-cause'\nimport {\n asPostcssNodeWithChildren,\n asStringNode,\n asTagNode,\n isStringNode,\n isTagNode,\n} from '@vltpkg/dss-parser'\nimport {\n assertSecurityArchive,\n removeDanglingEdges,\n removeNode,\n removeQuotes,\n} from './helpers.ts'\nimport type { ParserState } from '../types.ts'\nimport type { PostcssNode } from '@vltpkg/dss-parser'\n\nexport type CveInternals = {\n cveId: string\n}\n\nexport const parseInternals = (\n nodes: PostcssNode[],\n): CveInternals => {\n let cveId = ''\n\n if (isStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])) {\n cveId = removeQuotes(\n asStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n .value,\n )\n } else if (\n isTagNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n ) {\n cveId = asTagNode(\n asPostcssNodeWithChildren(nodes[0]).nodes[0],\n ).value\n }\n\n if (!cveId) {\n throw error('Expected a CVE ID', {\n found: asPostcssNodeWithChildren(nodes[0]).nodes[0],\n })\n }\n\n return { cveId }\n}\n\n/**\n * Filters out any node that does not have a CVE alert with the specified CVE ID.\n */\nexport const cve = async (state: ParserState) => {\n assertSecurityArchive(state, 'cve')\n\n let internals\n try {\n internals = parseInternals(\n asPostcssNodeWithChildren(state.current).nodes,\n )\n } catch (err) {\n throw error('Failed to parse :cve selector', { cause: err })\n }\n\n const { cveId } = internals\n for (const node of state.partial.nodes) {\n const report = state.securityArchive.get(node.id)\n const exclude = !report?.alerts.some(\n alert =>\n alert.props?.cveId?.trim().toLowerCase() ===\n cveId.trim().toLowerCase(),\n )\n if (exclude) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n", "import { error } from '@vltpkg/error-cause'\nimport {\n asPostcssNodeWithChildren,\n asStringNode,\n asTagNode,\n isStringNode,\n isTagNode,\n} from '@vltpkg/dss-parser'\nimport {\n assertSecurityArchive,\n removeDanglingEdges,\n removeNode,\n removeQuotes,\n} from './helpers.ts'\nimport type { ParserState } from '../types.ts'\nimport type { PostcssNode } from '@vltpkg/dss-parser'\n\nexport type CweInternals = {\n cweId: string\n}\n\nexport const parseInternals = (\n nodes: PostcssNode[],\n): CweInternals => {\n let cweId = ''\n\n if (isStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])) {\n cweId = removeQuotes(\n asStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n .value,\n )\n } else if (\n isTagNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n ) {\n cweId = asTagNode(\n asPostcssNodeWithChildren(nodes[0]).nodes[0],\n ).value\n }\n\n if (!cweId) {\n throw error('Expected a CWE ID', {\n found: asPostcssNodeWithChildren(nodes[0]).nodes[0],\n })\n }\n\n return { cweId }\n}\n\n/**\n * Filters out any node that does not have a CWE alert with the specified CWE ID.\n */\nexport const cwe = async (state: ParserState) => {\n assertSecurityArchive(state, 'cwe')\n\n let internals\n try {\n internals = parseInternals(\n asPostcssNodeWithChildren(state.current).nodes,\n )\n } catch (err) {\n throw error('Failed to parse :cwe selector', { cause: err })\n }\n\n const { cweId } = internals\n for (const node of state.partial.nodes) {\n const report = state.securityArchive.get(node.id)\n const exclude = !report?.alerts.some(alert =>\n alert.props?.cwes?.some(\n cwe =>\n cwe.id.trim().toLowerCase() === cweId.trim().toLowerCase(),\n ),\n )\n if (exclude) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **debugAccess** report alert.\n */\nexport const debug = createSecuritySelectorFilter(\n 'debug',\n 'debugAccess',\n)\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **deprecated** report alert.\n */\nexport const deprecated = createSecuritySelectorFilter(\n 'deprecated',\n 'deprecated',\n)\n", "import type { ParserState } from '../types.ts'\nimport { removeEdge, removeUnlinkedNodes } from './helpers.ts'\n\n/**\n * :dev Pseudo-Selector will only match devDependencies.\n */\nexport const dev = async (state: ParserState) => {\n // filter edges that don't have type 'dev'\n for (const edge of state.partial.edges) {\n if (edge.type !== 'dev') {\n removeEdge(state, edge)\n }\n }\n\n removeUnlinkedNodes(state)\n\n return state\n}\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **dynamicRequire** report alert.\n */\nexport const dynamic = createSecuritySelectorFilter(\n 'dynamic',\n 'dynamicRequire',\n)\n", "import type { ParserState } from '../types.ts'\nimport { removeNode } from './helpers.ts'\n\n/**\n * :empty Pseudo-Selector, matches only nodes that have no children.\n * It filters out any node that has edges out, i.e., has dependencies.\n */\nexport const empty = async (state: ParserState) => {\n for (const node of state.partial.nodes) {\n if (node.edgesOut.size > 0) {\n removeNode(state, node)\n }\n }\n return state\n}\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **highEntropyStrings** report alert.\n */\nexport const entropic = createSecuritySelectorFilter(\n 'entropic',\n 'highEntropyStrings',\n)\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **envVars** report alert.\n */\nexport const env = createSecuritySelectorFilter('env', 'envVars')\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **usesEval** report alert.\n */\nexport const evalParser = createSecuritySelectorFilter(\n 'eval',\n 'usesEval',\n)\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **filesystemAccess** report alert.\n */\nexport const fs = createSecuritySelectorFilter(\n 'fs',\n 'filesystemAccess',\n)\n", "import { error } from '@vltpkg/error-cause'\nimport {\n asPostcssNodeWithChildren,\n asStringNode,\n asTagNode,\n isStringNode,\n isTagNode,\n} from '@vltpkg/dss-parser'\nimport { removeQuotes } from './helpers.ts'\nimport type { ParserState } from '../types.ts'\nimport type { PostcssNode } from '@vltpkg/dss-parser'\n\n/**\n * Parses the internal parameters of the :host() pseudo selector.\n * Returns the context key that should be used to look up the host context function.\n */\nexport const parseInternals = (nodes: PostcssNode[]): string => {\n let contextKey = ''\n\n if (isStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])) {\n contextKey = removeQuotes(\n asStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n .value,\n )\n } else if (\n isTagNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n ) {\n const tagNode = asTagNode(\n asPostcssNodeWithChildren(nodes[0]).nodes[0],\n )\n contextKey = tagNode.value\n }\n\n if (!contextKey) {\n throw error('Expected a context key parameter for :host selector')\n }\n\n return contextKey\n}\n\n/**\n * :host Pseudo-Selector, switches the current graph context to a new\n * set of graphs loaded from a specific host context.\n *\n * This selector accepts a single parameter that specifies which host context\n * to use. The host context must be defined in the hostContexts map provided\n * to the Query constructor.\n *\n * Example:\n * - :host(local) - Switches to graphs loaded from the local context\n */\nexport const hostContext = async (state: ParserState) => {\n if (!state.hostContexts) {\n throw error('No host contexts available for :host selector')\n }\n\n let contextKey: string\n try {\n contextKey = parseInternals(\n asPostcssNodeWithChildren(state.current).nodes,\n )\n } catch (err) {\n throw error('Failed to parse :host selector', {\n cause: err,\n })\n }\n\n const contextFunction = state.hostContexts.get(contextKey)\n if (!contextFunction) {\n throw error(`Unknown host context: ${contextKey}`, {\n validOptions: Array.from(state.hostContexts.keys()),\n })\n }\n\n // Get the graphs from the host context function\n const {\n initialEdges,\n initialNodes,\n edges,\n nodes,\n securityArchive,\n } = await contextFunction()\n\n // Clear current nodes and edges\n state.securityArchive = securityArchive\n state.initial.nodes.clear()\n state.initial.edges.clear()\n state.partial.nodes.clear()\n state.partial.edges.clear()\n state.importers.clear()\n\n // Reset the initial state\n for (const node of initialNodes) {\n state.initial.nodes.add(node)\n }\n for (const edge of initialEdges) {\n state.initial.edges.add(edge)\n }\n\n // Populate with nodes and edges from all returned graphs\n for (const node of nodes) {\n state.partial.nodes.add(node)\n // use the current selected nodes by the context function as importers\n state.importers.add(node)\n }\n for (const edge of edges) {\n state.partial.edges.add(edge)\n }\n\n return state\n}\n", "import { error } from '@vltpkg/error-cause'\nimport { asError } from '@vltpkg/types'\nimport {\n asPostcssNodeWithChildren,\n asStringNode,\n asTagNode,\n isStringNode,\n isTagNode,\n} from '@vltpkg/dss-parser'\nimport {\n assertSecurityArchive,\n removeDanglingEdges,\n removeNode,\n removeQuotes,\n} from './helpers.ts'\nimport type { ParserState } from '../types.ts'\nimport type { PostcssNode } from '@vltpkg/dss-parser'\n\nexport type LicenseKinds =\n | 'unlicensed'\n | 'misc'\n | 'restricted'\n | 'ambiguous'\n | 'copyleft'\n | 'unknown'\n | 'none'\n | 'exception'\n | undefined\n\nexport type LicenseAlertTypes =\n | 'explicitlyUnlicensedItem'\n | 'miscLicenseIssues'\n | 'nonpermissiveLicense'\n | 'ambiguousClassifier'\n | 'copyleftLicense'\n | 'unidentifiedLicense'\n | 'noLicenseFound'\n | 'licenseException'\n | undefined\n\nconst kindsMap = new Map<LicenseKinds, LicenseAlertTypes>([\n ['unlicensed', 'explicitlyUnlicensedItem'],\n ['misc', 'miscLicenseIssues'],\n ['restricted', 'nonpermissiveLicense'],\n ['ambiguous', 'ambiguousClassifier'],\n ['copyleft', 'copyleftLicense'],\n ['unknown', 'unidentifiedLicense'],\n ['none', 'noLicenseFound'],\n ['exception', 'licenseException'],\n [undefined, undefined],\n])\nconst kinds = new Set(kindsMap.keys())\n\nexport const isLicenseKind = (\n value?: string,\n): value is LicenseKinds => kinds.has(value as LicenseKinds)\n\nexport const asLicenseKind = (value?: string): LicenseKinds => {\n if (!isLicenseKind(value)) {\n throw error('Expected a valid license kind', {\n found: value,\n validOptions: Array.from(kinds),\n })\n }\n return value\n}\n\nexport const parseInternals = (\n nodes: PostcssNode[],\n): { kind: LicenseKinds } => {\n let kind: LicenseKinds\n\n if (isStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])) {\n kind = asLicenseKind(\n removeQuotes(\n asStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n .value,\n ),\n )\n } else if (\n isTagNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n ) {\n kind = asLicenseKind(\n asTagNode(asPostcssNodeWithChildren(nodes[0]).nodes[0]).value,\n )\n }\n\n return { kind }\n}\n\nexport const license = async (state: ParserState) => {\n assertSecurityArchive(state, 'license')\n\n let internals\n try {\n internals = parseInternals(\n asPostcssNodeWithChildren(state.current).nodes,\n )\n } catch (err) {\n if (asError(err).message === 'Expected a query node') {\n // No parameters provided - pseudo state form: match ANY license defined (not 'none')\n for (const node of state.partial.nodes) {\n const report = state.securityArchive.get(node.id)\n // Exclude if no report or if it has 'noLicenseFound' alert\n const exclude =\n !report?.alerts ||\n report.alerts.some(alert => alert.type === 'noLicenseFound')\n if (exclude) {\n removeNode(state, node)\n }\n }\n removeDanglingEdges(state)\n return state\n } else {\n throw error('Failed to parse :license selector', { cause: err })\n }\n }\n\n const { kind } = internals\n const alertName = kindsMap.get(kind)\n for (const node of state.partial.nodes) {\n const report = state.securityArchive.get(node.id)\n const exclude = !report?.alerts.some(\n alert => alert.type === alertName,\n )\n if (exclude) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n", "import { splitDepID } from '@vltpkg/dep-id/browser'\nimport type { ParserState } from '../types.ts'\nimport { removeNode } from './helpers.ts'\n\n/**\n * :link Pseudo-Selector, matches only nodes that are file links.\n *\n * It filters out any node that is not of type 'file' or nodes of 'file'\n * type that ends with 'tar.gz' since these are local tarballs.\n */\nexport const link = async (state: ParserState) => {\n for (const node of state.partial.nodes) {\n const [type, path] = splitDepID(node.id)\n if (type !== 'file' || path.endsWith('tar.gz') || path === '.') {\n removeNode(state, node)\n }\n }\n\n for (const edge of state.partial.edges) {\n if (\n !edge.spec.file ||\n edge.spec.file.endsWith('tar.gz') ||\n edge.spec.file === '.'\n ) {\n state.partial.edges.delete(edge)\n }\n }\n\n return state\n}\n", "import { error } from '@vltpkg/error-cause'\nimport {\n asPostcssNodeWithChildren,\n asStringNode,\n asTagNode,\n isStringNode,\n isTagNode,\n} from '@vltpkg/dss-parser'\nimport {\n assertSecurityArchive,\n removeDanglingEdges,\n removeNode,\n removeQuotes,\n} from './helpers.ts'\nimport type { ParserState } from '../types.ts'\nimport type { PostcssNode } from '@vltpkg/dss-parser'\n\nexport type MalwareKinds =\n | '0'\n | '1'\n | '2'\n | '3'\n | 'critical'\n | 'high'\n | 'medium'\n | 'low'\n | undefined\n\nexport type MalwareAlertTypes =\n | 'malware'\n | 'gptMalware'\n | 'gptSecurity'\n | 'gptAnomaly'\n | undefined\n\nexport type MalwareComparator = '>' | '<' | '>=' | '<=' | undefined\n\nconst kindsMap = new Map<MalwareKinds, MalwareAlertTypes>([\n ['critical', 'malware'],\n ['high', 'gptMalware'],\n ['medium', 'gptSecurity'],\n ['low', 'gptAnomaly'],\n ['0', 'malware'],\n ['1', 'gptMalware'],\n ['2', 'gptSecurity'],\n ['3', 'gptAnomaly'],\n])\n\n// Map numerical values to their respective kinds for comparison operations\nconst kindLevelMap = new Map<MalwareKinds, number>([\n ['critical', 0],\n ['high', 1],\n ['medium', 2],\n ['low', 3],\n ['0', 0],\n ['1', 1],\n ['2', 2],\n ['3', 3],\n])\n\nconst kinds = new Set(kindsMap.keys())\n\nexport const isMalwareKind = (\n value?: string,\n): value is MalwareKinds => kinds.has(value as MalwareKinds)\n\nexport const asMalwareKind = (value?: string): MalwareKinds => {\n if (!isMalwareKind(value)) {\n throw error('Expected a valid malware kind', {\n found: value,\n validOptions: Array.from(kinds),\n })\n }\n return value\n}\n\nexport const parseInternals = (\n nodes: PostcssNode[],\n): { kind: MalwareKinds; comparator: MalwareComparator } => {\n // Handle case where no parameters are provided (parameterless :malware)\n if (!nodes[0]) {\n return { kind: undefined, comparator: undefined }\n }\n\n const selectorNode = asPostcssNodeWithChildren(nodes[0])\n if (!selectorNode.nodes[0]) {\n return { kind: undefined, comparator: undefined }\n }\n\n let kindValue = ''\n let comparator: MalwareComparator = undefined\n let kind: MalwareKinds\n\n // Parse the parameter (kind with optional comparator)\n if (isStringNode(selectorNode.nodes[0])) {\n kindValue = removeQuotes(\n asStringNode(selectorNode.nodes[0]).value,\n )\n } else if (isTagNode(selectorNode.nodes[0])) {\n kindValue = asTagNode(selectorNode.nodes[0]).value\n }\n\n // Extract comparator if present\n if (kindValue.startsWith('>=')) {\n comparator = '>='\n kindValue = kindValue.substring(2)\n } else if (kindValue.startsWith('<=')) {\n comparator = '<='\n kindValue = kindValue.substring(2)\n } else if (kindValue.startsWith('>')) {\n comparator = '>'\n kindValue = kindValue.substring(1)\n } else if (kindValue.startsWith('<')) {\n comparator = '<'\n kindValue = kindValue.substring(1)\n }\n\n // Validate the kind without comparator\n if (!comparator) {\n kind = asMalwareKind(kindValue)\n } else {\n // For comparisons, just make sure it's a valid numeric value or a valid kind\n if (isMalwareKind(kindValue)) {\n kind = kindValue\n } else {\n throw error(\n 'Expected a valid malware kind or number between 0-3',\n {\n found: kindValue,\n },\n )\n }\n }\n\n return { kind, comparator }\n}\n\n/**\n * :malware Pseudo-Selector, matches nodes with malware alerts.\n *\n * Usage:\n * - :malware - matches malware with severity >= medium (critical, high, medium but not low)\n * - :malware(critical) - matches specific malware kind\n * - :malware(>1) - matches malware with severity greater than 1\n * - :malware(\">=medium\") - matches malware with severity >= medium\n */\nexport const malware = async (state: ParserState) => {\n assertSecurityArchive(state, 'malware')\n\n let internals\n try {\n internals = parseInternals(\n asPostcssNodeWithChildren(state.current).nodes,\n )\n } catch (err) {\n throw error('Failed to parse :malware selector', { cause: err })\n }\n\n const { kind, comparator } = internals\n const alertName = comparator ? undefined : kindsMap.get(kind)\n\n for (const node of state.partial.nodes) {\n const report = state.securityArchive.get(node.id)\n // Always exclude nodes that don't have security data or alerts\n if (!report?.alerts || report.alerts.length === 0) {\n removeNode(state, node)\n }\n }\n\n for (const node of state.partial.nodes) {\n const report = state.securityArchive.get(node.id)\n let exclude = true\n\n if (report) {\n if (kind === undefined && comparator === undefined) {\n // Parameterless :malware - match malware alerts with severity >= medium (exclude low/gptAnomaly)\n exclude = !report.alerts.some(\n alert =>\n alert.type === 'malware' ||\n alert.type === 'gptMalware' ||\n alert.type === 'gptSecurity',\n )\n } else if (comparator) {\n // retrieve the value to compare against\n const kindLevel = kindLevelMap.get(kind)\n // the kindLevel value has already been validated at this point\n // and thus can never return an undefined/falsy value but ts doesn't\n // know about that, so we have the extra check here\n /* c8 ignore next - impossible */\n if (kindLevel == null) break\n\n // Check each alert to find any that match our comparison criteria\n for (const alert of report.alerts) {\n // Get the numerical value of the alert type\n const alertType = alert.type\n\n // retrieve a key to the current alert level to be compared against\n const currentAlertLevelKey = [...kindsMap.entries()].find(\n ([_, alertValue]) => alertValue === alertType,\n )?.[0]\n\n // perform the comparison based on the user-provided kindLevel\n if (currentAlertLevelKey) {\n const currentAlertLevel = kindLevelMap.get(\n currentAlertLevelKey,\n )\n /* c8 ignore next - impossible but ts doesn't know */\n if (currentAlertLevel == null) continue\n\n switch (comparator) {\n case '>':\n if (currentAlertLevel > kindLevel) {\n exclude = false\n }\n break\n case '<':\n if (currentAlertLevel < kindLevel) {\n exclude = false\n }\n break\n case '>=':\n if (currentAlertLevel >= kindLevel) {\n exclude = false\n }\n break\n case '<=':\n if (currentAlertLevel <= kindLevel) {\n exclude = false\n }\n break\n }\n\n // If we've found a match, no need to check other alerts\n if (!exclude) break\n }\n }\n } else {\n // Original exact match behavior\n exclude = !report.alerts.some(\n alert => alert.type === alertName,\n )\n }\n }\n\n if (exclude) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **minifiedFile** report alert.\n */\nexport const minified = createSecuritySelectorFilter(\n 'minified',\n 'minifiedFile',\n)\n", "import type { ParserState } from '../types.ts'\n\n/**\n * :missing Pseudo-Selector, matches only edges that are not linked to any node.\n * It filters out any edges that have a 'to' property, keeping only dangling edges\n * and clears all nodes from the result.\n */\nexport const missing = async (state: ParserState) => {\n for (const edge of state.partial.edges) {\n if (edge.to) {\n state.partial.edges.delete(edge)\n }\n }\n state.partial.nodes.clear()\n return state\n}\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **hasNativeCode** report alert.\n */\nexport const nativeParser = createSecuritySelectorFilter(\n 'native',\n 'hasNativeCode',\n)\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **networkAccess** report alert.\n */\nexport const network = createSecuritySelectorFilter(\n 'network',\n 'networkAccess',\n)\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have an **obfuscatedFile** report alert.\n */\nexport const obfuscated = createSecuritySelectorFilter(\n 'obfuscated',\n 'obfuscatedFile',\n)\n", "import type { ParserState } from '../types.ts'\nimport { removeEdge, removeUnlinkedNodes } from './helpers.ts'\n\n/**\n * :optional Pseudo-Selector will only match optional dependencies.\n */\nexport const optional = async (state: ParserState) => {\n // filter edges that aren't marked as optional\n for (const edge of state.partial.edges) {\n if (!edge.optional) {\n removeEdge(state, edge)\n }\n }\n\n removeUnlinkedNodes(state)\n\n return state\n}\n", "const objectToString = Object.prototype.toString;\n\nconst isError = value => objectToString.call(value) === '[object Error]';\n\nconst errorMessages = new Set([\n\t'network error', // Chrome\n\t'Failed to fetch', // Chrome\n\t'NetworkError when attempting to fetch resource.', // Firefox\n\t'The Internet connection appears to be offline.', // Safari 16\n\t'Network request failed', // `cross-fetch`\n\t'fetch failed', // Undici (Node.js)\n\t'terminated', // Undici (Node.js)\n\t' A network error occurred.', // Bun (WebKit)\n\t'Network connection lost', // Cloudflare Workers (fetch)\n]);\n\nexport default function isNetworkError(error) {\n\tconst isValid = error\n\t\t&& isError(error)\n\t\t&& error.name === 'TypeError'\n\t\t&& typeof error.message === 'string';\n\n\tif (!isValid) {\n\t\treturn false;\n\t}\n\n\tconst {message, stack} = error;\n\n\t// Safari 17+ has generic message but no stack for network errors\n\tif (message === 'Load failed') {\n\t\treturn stack === undefined\n\t\t\t// Sentry adds its own stack trace to the fetch error, so also check for that\n\t\t\t|| '__sentry_captured__' in error;\n\t}\n\n\t// Deno network errors start with specific text\n\tif (message.startsWith('error sending request for url')) {\n\t\treturn true;\n\t}\n\n\t// Standard network error messages\n\treturn errorMessages.has(message);\n}\n", "import isNetworkError from 'is-network-error';\n\nfunction validateRetries(retries) {\n\tif (typeof retries === 'number') {\n\t\tif (retries < 0) {\n\t\t\tthrow new TypeError('Expected `retries` to be a non-negative number.');\n\t\t}\n\n\t\tif (Number.isNaN(retries)) {\n\t\t\tthrow new TypeError('Expected `retries` to be a valid number or Infinity, got NaN.');\n\t\t}\n\t} else if (retries !== undefined) {\n\t\tthrow new TypeError('Expected `retries` to be a number or Infinity.');\n\t}\n}\n\nfunction validateNumberOption(name, value, {min = 0, allowInfinity = false} = {}) {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tif (typeof value !== 'number' || Number.isNaN(value)) {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be a number${allowInfinity ? ' or Infinity' : ''}.`);\n\t}\n\n\tif (!allowInfinity && !Number.isFinite(value)) {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be a finite number.`);\n\t}\n\n\tif (value < min) {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be \\u2265 ${min}.`);\n\t}\n}\n\nexport class AbortError extends Error {\n\tconstructor(message) {\n\t\tsuper();\n\n\t\tif (message instanceof Error) {\n\t\t\tthis.originalError = message;\n\t\t\t({message} = message);\n\t\t} else {\n\t\t\tthis.originalError = new Error(message);\n\t\t\tthis.originalError.stack = this.stack;\n\t\t}\n\n\t\tthis.name = 'AbortError';\n\t\tthis.message = message;\n\t}\n}\n\nfunction calculateDelay(retriesConsumed, options) {\n\tconst attempt = Math.max(1, retriesConsumed + 1);\n\tconst random = options.randomize ? (Math.random() + 1) : 1;\n\n\tlet timeout = Math.round(random * options.minTimeout * (options.factor ** (attempt - 1)));\n\ttimeout = Math.min(timeout, options.maxTimeout);\n\n\treturn timeout;\n}\n\nfunction calculateRemainingTime(start, max) {\n\tif (!Number.isFinite(max)) {\n\t\treturn max;\n\t}\n\n\treturn max - (performance.now() - start);\n}\n\nasync function onAttemptFailure({error, attemptNumber, retriesConsumed, startTime, options}) {\n\tconst normalizedError = error instanceof Error\n\t\t? error\n\t\t: new TypeError(`Non-error was thrown: \"${error}\". You should only throw errors.`);\n\n\tif (normalizedError instanceof AbortError) {\n\t\tthrow normalizedError.originalError;\n\t}\n\n\tconst retriesLeft = Number.isFinite(options.retries)\n\t\t? Math.max(0, options.retries - retriesConsumed)\n\t\t: options.retries;\n\n\tconst maxRetryTime = options.maxRetryTime ?? Number.POSITIVE_INFINITY;\n\n\tconst context = Object.freeze({\n\t\terror: normalizedError,\n\t\tattemptNumber,\n\t\tretriesLeft,\n\t\tretriesConsumed,\n\t});\n\n\tawait options.onFailedAttempt(context);\n\n\tif (calculateRemainingTime(startTime, maxRetryTime) <= 0) {\n\t\tthrow normalizedError;\n\t}\n\n\tconst consumeRetry = await options.shouldConsumeRetry(context);\n\n\tconst remainingTime = calculateRemainingTime(startTime, maxRetryTime);\n\n\tif (remainingTime <= 0 || retriesLeft <= 0) {\n\t\tthrow normalizedError;\n\t}\n\n\tif (normalizedError instanceof TypeError && !isNetworkError(normalizedError)) {\n\t\tif (consumeRetry) {\n\t\t\tthrow normalizedError;\n\t\t}\n\n\t\toptions.signal?.throwIfAborted();\n\t\treturn false;\n\t}\n\n\tif (!await options.shouldRetry(context)) {\n\t\tthrow normalizedError;\n\t}\n\n\tif (!consumeRetry) {\n\t\toptions.signal?.throwIfAborted();\n\t\treturn false;\n\t}\n\n\tconst delayTime = calculateDelay(retriesConsumed, options);\n\tconst finalDelay = Math.min(delayTime, remainingTime);\n\n\toptions.signal?.throwIfAborted();\n\n\tif (finalDelay > 0) {\n\t\tawait new Promise((resolve, reject) => {\n\t\t\tconst onAbort = () => {\n\t\t\t\tclearTimeout(timeoutToken);\n\t\t\t\toptions.signal?.removeEventListener('abort', onAbort);\n\t\t\t\treject(options.signal.reason);\n\t\t\t};\n\n\t\t\tconst timeoutToken = setTimeout(() => {\n\t\t\t\toptions.signal?.removeEventListener('abort', onAbort);\n\t\t\t\tresolve();\n\t\t\t}, finalDelay);\n\n\t\t\tif (options.unref) {\n\t\t\t\ttimeoutToken.unref?.();\n\t\t\t}\n\n\t\t\toptions.signal?.addEventListener('abort', onAbort, {once: true});\n\t\t});\n\t}\n\n\toptions.signal?.throwIfAborted();\n\n\treturn true;\n}\n\nexport default async function pRetry(input, options = {}) {\n\toptions = {...options};\n\n\tvalidateRetries(options.retries);\n\n\tif (Object.hasOwn(options, 'forever')) {\n\t\tthrow new Error('The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.');\n\t}\n\n\toptions.retries ??= 10;\n\toptions.factor ??= 2;\n\toptions.minTimeout ??= 1000;\n\toptions.maxTimeout ??= Number.POSITIVE_INFINITY;\n\toptions.maxRetryTime ??= Number.POSITIVE_INFINITY;\n\toptions.randomize ??= false;\n\toptions.onFailedAttempt ??= () => {};\n\toptions.shouldRetry ??= () => true;\n\toptions.shouldConsumeRetry ??= () => true;\n\n\t// Validate numeric options and normalize edge cases\n\tvalidateNumberOption('factor', options.factor, {min: 0, allowInfinity: false});\n\tvalidateNumberOption('minTimeout', options.minTimeout, {min: 0, allowInfinity: false});\n\tvalidateNumberOption('maxTimeout', options.maxTimeout, {min: 0, allowInfinity: true});\n\tvalidateNumberOption('maxRetryTime', options.maxRetryTime, {min: 0, allowInfinity: true});\n\n\t// Treat non-positive factor as 1 to avoid zero backoff or negative behavior\n\tif (!(options.factor > 0)) {\n\t\toptions.factor = 1;\n\t}\n\n\toptions.signal?.throwIfAborted();\n\n\tlet attemptNumber = 0;\n\tlet retriesConsumed = 0;\n\tconst startTime = performance.now();\n\n\twhile (Number.isFinite(options.retries) ? retriesConsumed <= options.retries : true) {\n\t\tattemptNumber++;\n\n\t\ttry {\n\t\t\toptions.signal?.throwIfAborted();\n\n\t\t\tconst result = await input(attemptNumber);\n\n\t\t\toptions.signal?.throwIfAborted();\n\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (await onAttemptFailure({\n\t\t\t\terror,\n\t\t\t\tattemptNumber,\n\t\t\t\tretriesConsumed,\n\t\t\t\tstartTime,\n\t\t\t\toptions,\n\t\t\t})) {\n\t\t\t\tretriesConsumed++;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Should not reach here, but in case it does, throw an error\n\tthrow new Error('Retry attempts exhausted without throwing an error.');\n}\n\nexport function makeRetriable(function_, options) {\n\treturn function (...arguments_) {\n\t\treturn pRetry(() => function_.apply(this, arguments_), options);\n\t};\n}\n", "import pRetry, { AbortError } from 'p-retry'\nimport { hydrate, splitDepID } from '@vltpkg/dep-id/browser'\nimport { error } from '@vltpkg/error-cause'\nimport { asError } from '@vltpkg/types'\nimport {\n compare,\n gt,\n major,\n minor,\n patch,\n satisfies,\n} from '@vltpkg/semver'\nimport {\n asPostcssNodeWithChildren,\n asStringNode,\n asTagNode,\n isStringNode,\n isTagNode,\n} from '@vltpkg/dss-parser'\nimport { removeNode, removeQuotes } from './helpers.ts'\nimport type { NodeLike, Packument } from '@vltpkg/types'\nimport type { ParserState } from '../types.ts'\nimport type { PostcssNode } from '@vltpkg/dss-parser'\n\n/**\n * The possible values accepted by the :outdated() pseudo selector.\n */\nexport type OutdatedKinds =\n | 'any'\n | 'major'\n | 'minor'\n | 'patch'\n | 'in-range'\n | 'out-of-range'\n\n/**\n * Result of the internal parsing of the :outdated() pseudo selector.\n */\nexport type OutdatedInternals = {\n kind: OutdatedKinds\n}\n\n/**\n * Extracts a semver type from a version string.\n */\nexport type SemverTypeExtraction = (\n version: string,\n) => number | undefined\n\nconst kinds = new Set<OutdatedKinds>([\n 'any',\n 'major',\n 'minor',\n 'patch',\n 'in-range',\n 'out-of-range',\n])\n\n/**\n * Checks if a string is a valid {@link OutdatedKinds}.\n */\nexport const isOutdatedKind = (\n value: string,\n): value is OutdatedKinds => kinds.has(value as OutdatedKinds)\n\n/**\n * Asserts that a string is a valid {@link OutdatedKinds}.\n */\nexport const asOutdatedKind = (value: string): OutdatedKinds => {\n if (!isOutdatedKind(value)) {\n throw error('Expected a valid outdated kind', {\n found: value,\n validOptions: Array.from(kinds),\n })\n }\n return value\n}\n\n/**\n * Fetches the available versions of a package from the npm registry.\n */\nexport const retrieveRemoteVersions = async (\n node: NodeLike,\n signal?: AbortSignal,\n): Promise<string[]> => {\n const spec = hydrate(node.id, String(node.name), node.options)\n if (!spec.registry || !node.name) {\n return []\n }\n\n const url = new URL(spec.registry)\n url.pathname = `/${node.name}`\n\n const response = await fetch(String(url), {\n headers: {\n Accept: 'application/vnd.npm.install-v1+json',\n },\n signal,\n })\n // on missing valid auth or API, it should abort the retry logic\n if (response.status === 404) {\n throw new AbortError('Missing API')\n }\n if (!response.ok) {\n throw error('Failed to fetch packument', {\n name: node.name,\n spec,\n response,\n })\n }\n const packument = (await response.json()) as Packument\n return Object.keys(packument.versions).sort(compare)\n}\n\n/**\n * Retrieves what kind of check the :outdated selector should perform.\n */\nexport const parseInternals = (\n nodes: PostcssNode[],\n): OutdatedInternals => {\n let kind: OutdatedKinds = 'any'\n\n if (isStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])) {\n kind = asOutdatedKind(\n removeQuotes(\n asStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n .value,\n ),\n )\n } else if (\n isTagNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n ) {\n kind = asOutdatedKind(\n asTagNode(asPostcssNodeWithChildren(nodes[0]).nodes[0]).value,\n )\n }\n\n return { kind }\n}\n\n/**\n * Filter nodes by queueing up for removal those that are not outdated.\n */\nexport const queueNode = async (\n state: ParserState,\n node: NodeLike,\n kind: OutdatedKinds,\n): Promise<NodeLike | undefined> => {\n if (!node.name || !node.version) {\n return node\n }\n\n const nodeVersion: string = node.version\n let versions: string[]\n try {\n versions = await pRetry(\n () => retrieveRemoteVersions(node, state.signal),\n {\n retries: state.retries,\n signal: state.signal,\n },\n )\n } catch (err) {\n // eslint-disable-next-line no-console\n console.warn(\n error('Could not retrieve registry versions', {\n name: node.name,\n cause: err,\n }),\n )\n versions = []\n }\n\n const greaterVersions = versions.filter((version: string) =>\n gt(version, nodeVersion),\n )\n\n // if there are no greater versions, then the node is not outdated\n if (!greaterVersions.length) {\n return node\n }\n\n const checkKind = new Map<OutdatedKinds, SemverTypeExtraction>([\n ['major', major],\n ['minor', minor],\n ['patch', patch],\n ])\n\n switch (kind) {\n case 'any':\n return\n case 'major':\n case 'minor':\n case 'patch': {\n return (\n greaterVersions.some((version: string) => {\n const va = checkKind.get(kind)?.(version)\n const vb = checkKind.get(kind)?.(nodeVersion)\n /* c8 ignore next - impossible but typescript doesn't know */\n if (va === undefined || vb === undefined) return false\n return va > vb\n })\n ) ?\n undefined\n : node\n }\n // the node should be part of the result as long as it has at least\n // one parent node that has a spec definition that satisfies one\n // of the available remove versions\n case 'in-range': {\n for (const edge of node.edgesIn) {\n // if the edge is not part of the partial results, skip it\n /* c8 ignore next */\n if (!state.partial.edges.has(edge)) continue\n\n if (\n greaterVersions.some(\n version =>\n edge.spec.final.range &&\n satisfies(version, edge.spec.final.range),\n )\n ) {\n return\n }\n }\n return node\n }\n // the node is part of the result as long as none of its parents has\n // a spec definition that satisfies one of the available remote versions\n case 'out-of-range': {\n for (const edge of node.edgesIn) {\n // if the edge is not part of the partial results, skip it\n /* c8 ignore next */\n if (!state.partial.edges.has(edge)) continue\n\n if (\n greaterVersions.some(\n version =>\n edge.spec.final.range &&\n satisfies(version, edge.spec.final.range),\n )\n ) {\n return node\n }\n }\n return\n }\n }\n}\n\n/**\n * Filters out nodes that are not outdated.\n *\n * The :outdated() pseudo selector supports one `type` argument,\n * possible values are the following:\n *\n * - `any`: Selects all nodes that have a greater version available.\n * - `major`: Selects all nodes that have a greater major version available.\n * - `minor`: Selects all nodes that have a greater minor version available.\n * - `patch`: Selects all nodes that have a greater patch version available.\n * - `in-range`: Selects all nodes that have a parent node with a spec definition\n * that satisfies one of the available remote versions.\n * - `out-of-range`: Selects all nodes that have a parent node with a spec definition\n * that does not satisfy any of the available remote versions.\n */\nexport const outdated = async (state: ParserState) => {\n let internals\n try {\n internals = parseInternals(\n asPostcssNodeWithChildren(state.current).nodes,\n )\n } catch (err) {\n if (asError(err).message === 'Expected a query node') {\n internals = { kind: 'any' } satisfies OutdatedInternals\n } else {\n throw error('Failed to parse :outdated selector', {\n cause: err,\n })\n }\n }\n\n const { kind } = internals\n const queue = []\n\n for (const node of state.partial.nodes) {\n // filter out nodes that are always ignored by the outdated selector\n if (\n node.mainImporter ||\n node.manifest?.private ||\n splitDepID(node.id)[0] !== 'registry'\n ) {\n removeNode(state, node)\n continue\n }\n\n // fetchs outdated info and performs checks to define\n // whether or not a node should be filtered out\n queue.push(queueNode(state, node, kind))\n }\n\n // nodes queued for removal are then finally removed\n const removeNodeQueue = await Promise.all(queue)\n for (const node of removeNodeQueue) {\n if (node) {\n removeNode(state, node)\n }\n }\n\n return state\n}\n", "import type { ParserState } from '../types.ts'\nimport { removeEdge, removeUnlinkedNodes } from './helpers.ts'\n\n/**\n * :overridden Pseudo-Selector, matches only edges that have a truthy overridden property in their spec.\n * It filters out any edges that don't have edge.spec.overridden set to a truthy value\n * and removes any unlinked nodes from the result.\n */\nexport const overridden = async (state: ParserState) => {\n // filter edges that don't have a truthy overridden property\n for (const edge of state.partial.edges) {\n if (!edge.spec.overridden) {\n removeEdge(state, edge)\n }\n }\n\n removeUnlinkedNodes(state)\n\n return state\n}\n", "import { minimatch } from 'minimatch'\nimport { error } from '@vltpkg/error-cause'\nimport { splitDepID } from '@vltpkg/dep-id/browser'\nimport { asError } from '@vltpkg/types'\nimport {\n asPostcssNodeWithChildren,\n asStringNode,\n isStringNode,\n} from '@vltpkg/dss-parser'\nimport {\n removeNode,\n removeDanglingEdges,\n removeQuotes,\n clear,\n} from './helpers.ts'\nimport type { ParserState } from '../types.ts'\n\n/**\n * Normalizes a path by trimming whitespace and removing leading './' or '.' prefix.\n * This ensures consistent path comparison regardless of how paths are specified.\n */\nexport function normalizePath(path: string): string {\n const trimmed = path.trim()\n\n // Handle root path case - normalize '.' to empty string for consistency\n if (trimmed === '.') {\n return ''\n }\n\n // Remove leading './' prefix\n if (trimmed.startsWith('./')) {\n return trimmed.slice(2)\n }\n\n return trimmed\n}\n\n/**\n * Creates a path matcher function that tests if\n * a given path matches a glob pattern.\n */\nexport function createPathMatcher(pattern: string, loose = false) {\n const normalizedPattern = normalizePath(pattern)\n const isRoot = normalizedPattern === '' || pattern.trim() === '.'\n\n return (path: string) => {\n const normalizedPath = normalizePath(path)\n\n if (isRoot) {\n return normalizedPath === '' || normalizedPath === '.'\n }\n try {\n return minimatch(normalizedPath, normalizedPattern, {\n dot: true,\n nocase: false,\n matchBase: normalizedPattern === '*',\n })\n } catch (err) {\n // In loose mode, return false for invalid patterns\n if (loose) {\n return false\n }\n // In strict mode, throw an error\n throw error(\n 'Invalid glob pattern in :path selector',\n asError(err),\n )\n }\n }\n}\n\n/**\n * :path(\"glob\") Pseudo-Selector will match only workspace & file\n * nodes whose file path matches the provided glob pattern relative\n * to the project root. Path patterns must be quoted strings to avoid\n * parser conflicts with special characters.\n */\nexport const path = async (state: ParserState) => {\n // Extract path container and handle empty parameters\n const pathContainer = asPostcssNodeWithChildren(state.current)\n if (!pathContainer.nodes[0]) {\n return clear(state)\n }\n\n // Extract the selector node and handle empty selectors\n const selector = asPostcssNodeWithChildren(pathContainer.nodes[0])\n if (!selector.nodes[0]) {\n return clear(state)\n }\n\n // Extract and validate the path pattern\n let pathPattern = ''\n if (isStringNode(selector.nodes[0])) {\n pathPattern = removeQuotes(asStringNode(selector.nodes[0]).value)\n } else {\n if (state.loose) {\n return clear(state)\n }\n throw error(\n 'Failed to parse path pattern in :path selector',\n new Error('Path pattern must be a quoted string'),\n )\n }\n\n // If no pattern provided, match nothing\n if (!pathPattern) {\n return clear(state)\n }\n\n // Check for unmatched brackets\n if (\n pathPattern === '[' ||\n (pathPattern.includes('[') && !pathPattern.includes(']'))\n ) {\n if (state.loose) {\n return clear(state)\n }\n throw error(\n 'Invalid glob pattern in :path selector',\n new Error(`Unmatched bracket in pattern: ${pathPattern}`),\n )\n }\n\n // Create path matcher function\n const matchPath = createPathMatcher(pathPattern, state.loose)\n\n // Filter nodes by path\n for (const node of state.partial.nodes) {\n /* c8 ignore next */\n const nodePath = node.location || ''\n const [type] = splitDepID(node.id)\n\n // Special case for main importer with root path pattern\n if (pathPattern === '.' && node.mainImporter) {\n continue // Keep main importer node for root path pattern\n }\n\n // Only match workspace or file nodes with matching paths\n const pathBased = type === 'workspace' || type === 'file'\n if (!pathBased || !matchPath(nodePath)) {\n removeNode(state, node)\n }\n }\n\n // Clean up any dangling edges\n removeDanglingEdges(state)\n return state\n}\n", "import type { ParserState } from '../types.ts'\nimport { removeEdge, removeUnlinkedNodes } from './helpers.ts'\n\n/**\n * :peer Pseudo-Selector will only match peer dependencies.\n */\nexport const peer = async (state: ParserState) => {\n // filter edges that aren't marked as peer\n for (const edge of state.partial.edges) {\n if (!edge.peer) {\n removeEdge(state, edge)\n }\n }\n\n removeUnlinkedNodes(state)\n\n return state\n}\n", "import { parse } from '@vltpkg/semver'\nimport { removeNode, removeDanglingEdges } from './helpers.ts'\nimport type { ParserState } from '../types.ts'\n\n/**\n * :prerelease Pseudo-selector, matches only nodes that have prerelease\n * elements in their parsed semver value.\n *\n * Examples of versions that should match:\n * - 19.2.0-canary-fa3feba6-20250623\n * - 1.0.0-beta.0\n * - 0.0.0-16\n * - 1.2.3-rc.1+rev.2\n *\n * Examples of versions that should NOT match:\n * - 1.0.0\n * - 99.9.9\n * - 0.0.1\n */\nexport const prerelease = async (state: ParserState) => {\n for (const node of state.partial.nodes) {\n const version = node.manifest?.version\n\n // Skip nodes without a version (like root/importer nodes)\n if (!version) {\n removeNode(state, node)\n continue\n }\n\n const parsedVersion = parse(version)\n if (!parsedVersion) {\n // Remove nodes with invalid semver versions\n removeNode(state, node)\n continue\n }\n\n // Check if the version has prerelease identifiers\n if (!parsedVersion.prerelease?.length) {\n // Remove nodes that don't have prerelease identifiers\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n", "import pRetry, { AbortError } from 'p-retry'\nimport { hydrate, splitDepID } from '@vltpkg/dep-id/browser'\nimport { error } from '@vltpkg/error-cause'\nimport { asError } from '@vltpkg/types'\nimport {\n asPostcssNodeWithChildren,\n asStringNode,\n asTagNode,\n isStringNode,\n isTagNode,\n} from '@vltpkg/dss-parser'\nimport {\n removeDanglingEdges,\n removeNode,\n removeQuotes,\n} from './helpers.ts'\nimport type { NodeLike, Packument } from '@vltpkg/types'\nimport type { ParserState } from '../types.ts'\nimport type { PostcssNode } from '@vltpkg/dss-parser'\n\n/**\n * The possible comparator values accepted by the :published() pseudo selector.\n */\nexport type PublishedComparator = '>' | '<' | '>=' | '<=' | undefined\n\n/**\n * Result of the internal parsing of the :published() pseudo selector.\n */\nexport type PublishedInternals = {\n relativeDate: string\n comparator: PublishedComparator\n}\n\n/**\n * Fetches the published date of a package version from the npm registry.\n */\nexport const retrieveRemoteDate = async (\n node: NodeLike,\n signal?: AbortSignal,\n): Promise<string | undefined> => {\n const spec = hydrate(node.id, String(node.name), node.options)\n if (!spec.registry || !node.name || !node.version) {\n return undefined\n }\n\n const url = new URL(spec.registry)\n url.pathname = `/${node.name}`\n\n const response = await fetch(String(url), {\n signal,\n })\n // on missing valid auth or API, it should abort the retry logic\n if (response.status === 404) {\n throw new AbortError('Missing API')\n }\n if (!response.ok) {\n throw error('Failed to fetch packument', {\n name: node.name,\n spec,\n response,\n })\n }\n const packument = (await response.json()) as Packument\n const res = packument.time?.[node.version]\n return res\n}\n\n/**\n * Retrieves what kind of check the :published selector should perform.\n */\nexport const parseInternals = (\n nodes: PostcssNode[],\n): PublishedInternals => {\n let value = ''\n\n if (isStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])) {\n value = removeQuotes(\n asStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n .value,\n )\n } else if (\n isTagNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n ) {\n const tagNode = asTagNode(\n asPostcssNodeWithChildren(nodes[0]).nodes[0],\n )\n value = tagNode.value\n }\n\n // Check if the value starts with a comparator\n let comparator: PublishedComparator\n let relativeDate = value\n\n if (value.startsWith('>=')) {\n comparator = '>='\n relativeDate = value.slice(2)\n } else if (value.startsWith('<=')) {\n comparator = '<='\n relativeDate = value.slice(2)\n } else if (value.startsWith('>')) {\n comparator = '>'\n relativeDate = value.slice(1)\n } else if (value.startsWith('<')) {\n comparator = '<'\n relativeDate = value.slice(1)\n }\n\n return { relativeDate, comparator }\n}\n\n/**\n * Filter nodes by queueing up for removal those that don't match the date criteria.\n */\nexport const queueNode = async (\n state: ParserState,\n node: NodeLike,\n relativeDate: string,\n comparator: PublishedComparator,\n): Promise<NodeLike | undefined> => {\n if (!node.name || !node.version) {\n return node\n }\n\n let publishedDate: string | undefined\n try {\n publishedDate = await pRetry(\n () => retrieveRemoteDate(node, state.signal),\n {\n retries: state.retries,\n signal: state.signal,\n },\n )\n } catch (err) {\n // eslint-disable-next-line no-console\n console.warn(\n error('Could not retrieve registry publish date', {\n name: node.name,\n cause: err,\n }),\n )\n return node\n }\n\n if (!publishedDate) {\n return node\n }\n\n // only matches the same amount of date information\n // as provided in the relative date\n const nodeDate = new Date(\n publishedDate.slice(0, relativeDate.length),\n )\n const compareDate = new Date(relativeDate)\n\n switch (comparator) {\n case '>':\n return nodeDate > compareDate ? undefined : node\n case '<':\n return nodeDate < compareDate ? undefined : node\n case '>=':\n return nodeDate >= compareDate ? undefined : node\n case '<=':\n return nodeDate <= compareDate ? undefined : node\n default:\n return nodeDate.getTime() === compareDate.getTime() ?\n undefined\n : node\n }\n}\n\n/**\n * Filters out nodes that don't match the published date criteria.\n *\n * The :published() pseudo selector supports a date parameter that can be prefixed\n * with a comparator (>, <, >=, <=). If no comparator is provided, it will match\n * exact dates.\n *\n * Examples:\n * - :published(\"2024-01-01\") - Matches packages published exactly on January 1st, 2024\n * - :published(\">2024-01-01\") - Matches packages published after January 1st, 2024\n * - :published(\"<=2023-12-31\") - Matches packages published on or before December 31st, 2023\n */\nexport const published = async (state: ParserState) => {\n let internals\n try {\n internals = parseInternals(\n asPostcssNodeWithChildren(state.current).nodes,\n )\n } catch (err) {\n if (asError(err).message === 'Expected a query node') {\n // No parameters provided - pseudo state form: match ANY published metadata\n for (const node of state.partial.nodes) {\n // filter out nodes that are always ignored by the published selector\n if (\n node.mainImporter ||\n node.manifest?.private ||\n splitDepID(node.id)[0] !== 'registry'\n ) {\n removeNode(state, node)\n continue\n }\n\n // For pseudo state form, we just check if the node has published metadata\n // This is equivalent to checking if it's a registry package with version info\n if (!node.name || !node.version) {\n removeNode(state, node)\n }\n }\n removeDanglingEdges(state)\n return state\n } else {\n throw error('Failed to parse :published selector', {\n cause: err,\n })\n }\n }\n\n const { relativeDate, comparator } = internals\n const queue = []\n\n for (const node of state.partial.nodes) {\n // filter out nodes that are always ignored by the published selector\n if (\n node.mainImporter ||\n node.manifest?.private ||\n splitDepID(node.id)[0] !== 'registry'\n ) {\n removeNode(state, node)\n continue\n }\n\n // fetch published date info and perform checks to define\n // whether or not a node should be filtered out\n queue.push(queueNode(state, node, relativeDate, comparator))\n }\n\n // nodes queued for removal are then finally removed\n const removeNodeQueue = await Promise.all(queue)\n for (const node of removeNodeQueue) {\n if (node) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n", "import { asManifest } from '@vltpkg/types'\nimport type { ParserState } from '../types.ts'\nimport { removeNode, removeDanglingEdges } from './helpers.ts'\n\n/**\n * :private Pseudo-Selector will only match packages that have\n * a `private: true` key set in their `package.json` metadata.\n */\nexport const privateParser = async (state: ParserState) => {\n for (const node of state.partial.nodes) {\n if (!node.manifest || !asManifest(node.manifest).private) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n", "import type { ParserState } from '../types.ts'\nimport { removeEdge, removeUnlinkedNodes } from './helpers.ts'\n\n/**\n * :prod Pseudo-Selector will only match production dependencies.\n */\nexport const prod = async (state: ParserState) => {\n // filter edges that don't have type 'prod'\n for (const edge of state.partial.edges) {\n if (edge.type !== 'prod') {\n removeEdge(state, edge)\n }\n }\n\n removeUnlinkedNodes(state)\n\n return state\n}\n", "import type { ParserState } from '../types.ts'\n\n/**\n * :root Pseudo-Element will return the project root node for the graph.\n * It matches only nodes marked as `mainImporter`.\n */\nexport const root = async (state: ParserState) => {\n for (const edge of state.partial.edges) {\n if (!edge.to?.mainImporter) {\n state.partial.edges.delete(edge)\n }\n }\n for (const node of state.partial.nodes) {\n if (!node.mainImporter) {\n state.partial.nodes.delete(node)\n }\n }\n return state\n}\n", "import { removeDanglingEdges, removeNode } from './helpers.ts'\nimport type { ParserState } from '../types.ts'\n\n/**\n * :scanned pseudo selector.\n *\n * Remove all nodes that do not have available metadata\n * in the security archive.\n */\nexport const scanned = async (state: ParserState) => {\n for (const node of state.partial.nodes) {\n if (!state.securityArchive?.has(node.id)) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n", "import { error } from '@vltpkg/error-cause'\nimport { asError } from '@vltpkg/types'\nimport {\n asPostcssNodeWithChildren,\n asStringNode,\n asTagNode,\n isStringNode,\n isTagNode,\n} from '@vltpkg/dss-parser'\nimport {\n assertSecurityArchive,\n removeDanglingEdges,\n removeNode,\n removeQuotes,\n} from './helpers.ts'\nimport type { PackageScore } from '@vltpkg/security-archive'\nimport type { ParserState } from '../types.ts'\nimport type { PostcssNode } from '@vltpkg/dss-parser'\n\nexport type ScoreKinds = keyof PackageScore\n\nexport type ScoreComparator =\n | '>'\n | '<'\n | '>='\n | '<='\n | '='\n | undefined\n\nconst kinds = new Set<ScoreKinds | undefined>([\n 'overall',\n 'license',\n 'maintenance',\n 'quality',\n 'supplyChain',\n 'vulnerability',\n undefined,\n])\n\nexport const isScoreKind = (value?: string): value is ScoreKinds =>\n kinds.has(value as ScoreKinds)\n\nexport const asScoreKind = (value?: string): ScoreKinds => {\n if (!isScoreKind(value)) {\n throw error('Expected a valid score kind', {\n found: value,\n validOptions: Array.from(kinds),\n })\n }\n return value\n}\n\nexport const parseInternals = (\n nodes: PostcssNode[],\n): {\n comparator: ScoreComparator\n rate: number\n kind: ScoreKinds\n} => {\n let rateStr = ''\n let comparator: ScoreComparator = '='\n let kind: ScoreKinds = 'overall'\n\n // Parse the first parameter (rate with optional comparator)\n if (isStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])) {\n rateStr = removeQuotes(\n asStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n .value,\n )\n } else if (\n isTagNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n ) {\n const tagNode = asTagNode(\n asPostcssNodeWithChildren(nodes[0]).nodes[0],\n )\n rateStr = tagNode.value\n }\n\n // Extract comparator if present\n if (rateStr.startsWith('>=')) {\n comparator = '>='\n rateStr = rateStr.substring(2)\n } else if (rateStr.startsWith('<=')) {\n comparator = '<='\n rateStr = rateStr.substring(2)\n } else if (rateStr.startsWith('>')) {\n comparator = '>'\n rateStr = rateStr.substring(1)\n } else if (rateStr.startsWith('<')) {\n comparator = '<'\n rateStr = rateStr.substring(1)\n }\n\n // Parse rate as number\n let rate = parseFloat(rateStr)\n\n // Normalize to 0-1 range if needed\n if (rate > 1) {\n rate = rate / 100\n }\n\n // Validate rate is in acceptable range\n if (rate < 0 || rate > 1) {\n throw error('Expected rate to be between 0 and 100', {\n found: rateStr,\n })\n }\n\n // Parse the second parameter (kind) if present\n if (nodes.length > 1) {\n if (isStringNode(asPostcssNodeWithChildren(nodes[1]).nodes[0])) {\n kind = asScoreKind(\n removeQuotes(\n asStringNode(asPostcssNodeWithChildren(nodes[1]).nodes[0])\n .value,\n ),\n )\n } else if (\n isTagNode(asPostcssNodeWithChildren(nodes[1]).nodes[0])\n ) {\n kind = asScoreKind(\n asTagNode(asPostcssNodeWithChildren(nodes[1]).nodes[0]).value,\n )\n }\n }\n\n return { comparator, rate, kind }\n}\n\nexport const score = async (state: ParserState) => {\n assertSecurityArchive(state, 'score')\n\n let internals\n try {\n internals = parseInternals(\n asPostcssNodeWithChildren(state.current).nodes,\n )\n } catch (err) {\n if (asError(err).message === 'Expected a query node') {\n // No parameters provided - pseudo state form: match ANY score (scanned packages)\n for (const node of state.partial.nodes) {\n const report = state.securityArchive.get(node.id)\n if (!report) {\n removeNode(state, node)\n }\n }\n removeDanglingEdges(state)\n return state\n } else {\n throw error('Failed to parse :score selector', { cause: err })\n }\n }\n\n const { comparator, rate, kind } = internals\n for (const node of state.partial.nodes) {\n const report = state.securityArchive.get(node.id)\n if (!report) {\n removeNode(state, node)\n continue\n }\n\n const scoreValue = report.score[kind]\n\n let exclude = false\n switch (comparator) {\n case '>':\n exclude = scoreValue <= rate\n break\n case '<':\n exclude = scoreValue >= rate\n break\n case '>=':\n exclude = scoreValue < rate\n break\n case '<=':\n exclude = scoreValue > rate\n break\n default: // '='\n exclude = scoreValue !== rate\n break\n }\n\n if (exclude) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n", "import type { NodeLike } from '@vltpkg/types'\nimport type { ParserState } from '../types.ts'\nimport { removeNode, removeDanglingEdges } from './helpers.ts'\n\n/**\n * Checks if a node needs to be built based on the conditions from the reify build process:\n * 1. Has install lifecycle scripts (install, preinstall, postinstall)\n * 2. Is an importer or git dependency with prepare scripts (prepare, preprepare, postprepare)\n */\nconst nodeNeedsBuild = (node: NodeLike): boolean => {\n const { manifest } = node\n /* c8 ignore next */\n if (!manifest) return false\n\n const { scripts = {} } = manifest\n\n // Check for install lifecycle scripts\n const runInstall = !!(\n scripts.install ||\n scripts.preinstall ||\n scripts.postinstall\n )\n if (runInstall) return true\n\n // Check for prepare scripts on importers or git dependencies\n const prepable = node.id.startsWith('git') || node.importer\n const runPrepare =\n !!(\n (scripts.prepare || scripts.preprepare || scripts.postprepare)\n /* c8 ignore next 2 */\n ) && prepable\n if (runPrepare) return true\n\n return false\n}\n\n/**\n * :scripts Pseudo-Selector filters nodes based on whether they need to be built.\n *\n * A node needs to be built if it has:\n * - Install lifecycle scripts (install, preinstall, postinstall)\n * - Prepare scripts on importers or git dependencies (prepare, preprepare, postprepare)\n */\nexport const scripts = async (state: ParserState) => {\n for (const node of state.partial.nodes) {\n if (!nodeNeedsBuild(node)) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **shellAccess** report alert.\n */\nexport const shell = createSecuritySelectorFilter(\n 'shell',\n 'shellAccess',\n)\n", "import {\n satisfies,\n gt,\n gte,\n lt,\n lte,\n eq,\n neq,\n parse,\n parseRange,\n} from '@vltpkg/semver'\nimport type { Version } from '@vltpkg/semver'\nimport { error } from '@vltpkg/error-cause'\nimport { asError } from '@vltpkg/types'\nimport { parseInternals as parseAttrInternals } from './attr.ts'\nimport type { AttrInternals } from './attr.ts'\nimport { getManifestPropertyValues } from '../attribute.ts'\nimport {\n asAttributeNode,\n asPostcssNodeWithChildren,\n asPseudoNode,\n asStringNode,\n asTagNode,\n isAttributeNode,\n isPseudoNode,\n isStringNode,\n isTagNode,\n} from '@vltpkg/dss-parser'\nimport { removeNode, removeQuotes } from './helpers.ts'\nimport type { ParserState } from '../types.ts'\nimport type { PostcssNode } from '@vltpkg/dss-parser'\n\nexport type SemverInternals = {\n semverValue: string\n semverFunction: SemverComparatorFn\n compareAttribute: SemverCompareAttribute\n}\n\nexport type SemverFunctionNames =\n | 'satisfies'\n | 'gt'\n | 'gte'\n | 'lt'\n | 'lte'\n | 'eq'\n | 'neq'\nexport type SemverComparatorFn = (\n version: Version | string,\n range: string,\n) => boolean\nexport type SemverCompareAttribute =\n | Pick<AttrInternals, 'attribute' | 'properties'>\n | undefined\n\nconst semverFunctionNames = new Set([\n 'satisfies',\n 'gt',\n 'gte',\n 'lt',\n 'lte',\n 'eq',\n 'neq',\n])\nexport const isSemverFunctionName = (\n name: string,\n): name is SemverFunctionNames => semverFunctionNames.has(name)\n\nexport const asSemverFunctionName = (\n name: string,\n): SemverFunctionNames => {\n if (!isSemverFunctionName(name)) {\n throw error('Invalid semver function name', {\n found: name,\n validOptions: Array.from(semverFunctionNames),\n })\n }\n return name\n}\n\nconst semverFunctions = new Map<\n SemverFunctionNames,\n SemverComparatorFn\n>([\n ['satisfies', satisfies],\n ['gt', gt],\n ['gte', gte],\n ['lt', lt],\n ['lte', lte],\n ['eq', eq],\n ['neq', neq],\n])\n\nexport const parseInternals = (\n nodes: PostcssNode[],\n loose: boolean,\n): SemverInternals => {\n // tries to parse the first param as a string node, otherwise defaults\n // to reading all postcss nodes as just strings, since it just means\n // the value was defined as an unquoted string\n let semverValue = ''\n try {\n semverValue = removeQuotes(\n asStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n .value,\n )\n } catch (err) {\n if (\n asError(err).message === 'Mismatching query node' &&\n isTagNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n ) {\n // Handle tag node (unquoted values like >=2.0.0)\n const tagNode = asTagNode(\n asPostcssNodeWithChildren(nodes[0]).nodes[0],\n )\n semverValue = tagNode.value\n } else {\n throw err\n }\n }\n\n // second param is the function name\n let fnName: SemverFunctionNames = 'satisfies'\n try {\n // if there is a second node defined, try to parse it as a string node\n // first and if that fails, then parse it as a tag node which just means\n // it was defined as an unquoted string\n if (nodes[1]) {\n try {\n fnName = asSemverFunctionName(\n removeQuotes(\n asStringNode(asPostcssNodeWithChildren(nodes[1]).nodes[0])\n .value,\n ),\n )\n } catch (err) {\n if (asError(err).message === 'Mismatching query node') {\n fnName = asSemverFunctionName(\n asTagNode(asPostcssNodeWithChildren(nodes[1]).nodes[0])\n .value,\n )\n } else {\n throw err\n }\n }\n }\n } catch (e) {\n // allow invalid semver function names in loose mode, defaults to satisfies\n if (!loose) {\n throw e\n }\n }\n\n const semverFunction = semverFunctions.get(fnName)\n // the following should never happen as long as the semver function names\n // type and Set are correctly mirroring each other values\n /* c8 ignore start */\n if (!semverFunction) {\n throw error('Invalid semver function name', {\n found: fnName,\n validOptions: Array.from(semverFunctions.keys()),\n })\n }\n /* c8 ignore stop */\n\n // optional third param is the compare value\n let compareAttribute: SemverCompareAttribute\n if (nodes[2]) {\n const parentNode = asPostcssNodeWithChildren(nodes[2])\n const currNode = parentNode.nodes[0]\n if (isAttributeNode(currNode)) {\n const { attribute } = asAttributeNode(currNode)\n compareAttribute = {\n attribute,\n properties: [attribute],\n }\n } else if (isPseudoNode(currNode)) {\n compareAttribute = parseAttrInternals(\n asPseudoNode(currNode).nodes,\n )\n } else if (isStringNode(currNode)) {\n const attribute = removeQuotes(asStringNode(currNode).value)\n compareAttribute = {\n attribute,\n properties: [attribute],\n }\n }\n }\n\n return {\n semverValue,\n semverFunction,\n compareAttribute,\n }\n}\n\nexport const semverParser = async (state: ParserState) => {\n let internals\n try {\n internals = parseInternals(\n asPostcssNodeWithChildren(state.current).nodes,\n !!state.loose,\n )\n } catch (err) {\n throw error('Failed to parse :semver selector', {\n cause: err,\n })\n }\n\n const { semverValue, semverFunction, compareAttribute } = internals\n\n for (const node of state.partial.nodes) {\n if (compareAttribute) {\n const compareValues = getManifestPropertyValues(\n node,\n compareAttribute.properties,\n compareAttribute.attribute,\n )\n\n // if the provided semver value is a fixed semver version and the\n // compare attribute is resolving to a range value, then we flip the\n // order of comparison, in case it's a \"satisfies\" function check\n const compareValue = compareValues?.[0]\n const semverValueVersion = parse(semverValue)\n const compareValueRange =\n compareValue && parseRange(compareValue)\n if (\n semverFunction === satisfies &&\n semverValueVersion &&\n compareValueRange\n ) {\n if (!satisfies(semverValueVersion, compareValueRange)) {\n removeNode(state, node)\n }\n // otherwise just compares the read attribute to the semver value\n } else if (\n !compareValue ||\n !semverFunction(compareValue, semverValue)\n ) {\n removeNode(state, node)\n }\n } else {\n const manifestVersion = node.manifest?.version\n if (\n !manifestVersion ||\n !semverFunction(manifestVersion, semverValue)\n ) {\n removeNode(state, node)\n }\n }\n }\n\n return state\n}\n", "import { error } from '@vltpkg/error-cause'\nimport {\n asPostcssNodeWithChildren,\n asStringNode,\n asTagNode,\n isStringNode,\n isTagNode,\n} from '@vltpkg/dss-parser'\nimport {\n assertSecurityArchive,\n removeDanglingEdges,\n removeNode,\n removeQuotes,\n} from './helpers.ts'\nimport type { ParserState } from '../types.ts'\nimport type { PostcssNode } from '@vltpkg/dss-parser'\n\nexport type SeverityKinds =\n | '0'\n | '1'\n | '2'\n | '3'\n | 'critical'\n | 'high'\n | 'medium'\n | 'low'\n | undefined\n\nexport type SeverityAlertTypes =\n | 'criticalCVE'\n | 'cve'\n | 'potentialVulnerability'\n | 'mildCVE'\n | undefined\n\nexport type SeverityComparator = '>' | '<' | '>=' | '<=' | undefined\n\nconst kindsMap = new Map<SeverityKinds, SeverityAlertTypes>([\n ['critical', 'criticalCVE'],\n ['high', 'cve'],\n ['medium', 'potentialVulnerability'],\n ['low', 'mildCVE'],\n ['0', 'criticalCVE'],\n ['1', 'cve'],\n ['2', 'potentialVulnerability'],\n ['3', 'mildCVE'],\n])\n\n// Map numerical values to their respective kinds for comparison operations\nconst kindLevelMap = new Map<SeverityKinds, number>([\n ['critical', 0],\n ['high', 1],\n ['medium', 2],\n ['low', 3],\n ['0', 0],\n ['1', 1],\n ['2', 2],\n ['3', 3],\n])\n\nconst kinds = new Set(kindsMap.keys())\n\nexport const isSeverityKind = (\n value?: string,\n): value is SeverityKinds => kinds.has(value as SeverityKinds)\n\nexport const asSeverityKind = (value?: string): SeverityKinds => {\n if (!isSeverityKind(value)) {\n throw error('Expected a valid severity kind', {\n found: value,\n validOptions: Array.from(kinds),\n })\n }\n return value\n}\n\nexport const parseInternals = (\n nodes: PostcssNode[],\n): {\n kind: SeverityKinds\n comparator: SeverityComparator\n} => {\n let kind: SeverityKinds\n let comparator: SeverityComparator\n\n if (nodes.length === 0) {\n throw error('Missing severity kind parameter')\n }\n\n let kindValue = ''\n if (isStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])) {\n kindValue = removeQuotes(\n asStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n .value,\n )\n } else if (\n isTagNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n ) {\n kindValue = asTagNode(\n asPostcssNodeWithChildren(nodes[0]).nodes[0],\n ).value\n }\n\n // Extract comparator if present\n if (kindValue.startsWith('>=')) {\n comparator = '>='\n kindValue = kindValue.substring(2)\n } else if (kindValue.startsWith('<=')) {\n comparator = '<='\n kindValue = kindValue.substring(2)\n } else if (kindValue.startsWith('>')) {\n comparator = '>'\n kindValue = kindValue.substring(1)\n } else if (kindValue.startsWith('<')) {\n comparator = '<'\n kindValue = kindValue.substring(1)\n }\n\n // Parse kind value\n if (kindValue) {\n if (isSeverityKind(kindValue)) {\n kind = kindValue\n } else {\n throw error(\n 'Expected a valid severity kind or number between 0-3',\n {\n found: kindValue,\n },\n )\n }\n }\n\n return { kind, comparator }\n}\n\nexport const severity = async (state: ParserState) => {\n assertSecurityArchive(state, 'severity')\n\n let internals\n try {\n internals = parseInternals(\n asPostcssNodeWithChildren(state.current).nodes,\n )\n } catch (err) {\n throw error('Failed to parse :severity selector', { cause: err })\n }\n\n const { kind, comparator } = internals\n\n for (const node of state.partial.nodes) {\n const report = state.securityArchive.get(node.id)\n // Always exclude nodes that don't have security data or alerts\n if (!report?.alerts || report.alerts.length === 0) {\n removeNode(state, node)\n }\n }\n\n for (const node of state.partial.nodes) {\n const report = state.securityArchive.get(node.id)\n let exclude = true\n\n if (report) {\n if (comparator) {\n // retrieve the value to compare against\n const kindLevel = kindLevelMap.get(kind)\n // the kindLevel value has already been validated at this point\n // and thus can never return an undefined/falsy value but ts doesn't\n // know about that, so we have the extra check here\n /* c8 ignore next - impossible */\n if (!kindLevel) break\n\n // Check each alert to find any that match our comparison criteria\n for (const alert of report.alerts) {\n // Get the numerical value of the alert type\n const alertType = alert.type\n\n // retrieve a key to the current alert level to be compared against\n const currentAlertLevelKey = [...kindsMap.entries()].find(\n ([_, alertValue]) => alertValue === alertType,\n )?.[0]\n\n // perform the comparison based on the user-provided kindLevel\n if (currentAlertLevelKey) {\n const currentAlertLevel = kindLevelMap.get(\n currentAlertLevelKey,\n )\n /* c8 ignore next - impossible but ts doesn't know */\n if (currentAlertLevel == null) continue\n\n switch (comparator) {\n case '>':\n if (currentAlertLevel > kindLevel) {\n exclude = false\n }\n break\n case '<':\n if (currentAlertLevel < kindLevel) {\n exclude = false\n }\n break\n case '>=':\n if (currentAlertLevel >= kindLevel) {\n exclude = false\n }\n break\n case '<=':\n if (currentAlertLevel <= kindLevel) {\n exclude = false\n }\n break\n }\n }\n }\n } else {\n // Original exact match behavior\n const alertName = kindsMap.get(kind)\n exclude = !report.alerts.some(\n alert => alert.type === alertName,\n )\n }\n }\n\n if (exclude) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n", "import { error } from '@vltpkg/error-cause'\nimport { asError } from '@vltpkg/types'\nimport {\n asPostcssNodeWithChildren,\n asStringNode,\n asTagNode,\n isTagNode,\n} from '@vltpkg/dss-parser'\nimport {\n removeEdge,\n removeUnlinkedNodes,\n removeQuotes,\n} from './helpers.ts'\nimport type { ParserState } from '../types.ts'\nimport type { PostcssNode } from '@vltpkg/dss-parser'\n\nexport type SpecInternals = {\n specValue: string\n}\n\nexport const parseInternals = (\n nodes: PostcssNode[],\n): SpecInternals => {\n // tries to parse the first param as a string node, otherwise defaults\n // to reading all postcss nodes as just strings, since it just means\n // the value was defined as an unquoted string\n let specValue = ''\n\n if (nodes.length === 0) {\n throw new Error('No nodes provided to parseInternals')\n }\n\n const firstNode = asPostcssNodeWithChildren(nodes[0])\n\n if (firstNode.nodes.length === 0) {\n throw new Error('First node has no child nodes')\n }\n\n // Try to parse as a quoted string first (single string node)\n if (firstNode.nodes.length === 1) {\n const targetNode = firstNode.nodes[0]\n try {\n specValue = removeQuotes(asStringNode(targetNode).value)\n return { specValue }\n } catch (err) {\n if (\n asError(err).message === 'Mismatching query node' &&\n isTagNode(targetNode)\n /* c8 ignore start */\n ) {\n // Handle simple unquoted single-token values like \"1\"\n const tagNode = asTagNode(targetNode)\n specValue = tagNode.value\n return { specValue }\n /* c8 ignore stop */\n } else {\n throw err\n }\n }\n }\n\n // Handle unquoted complex values that get parsed into multiple nodes\n // This happens when unquoted values contain dots, like ^1.0.0 which becomes:\n // - Tag: \"^1\"\n // - ClassName: \"0\" (from .0)\n // - ClassName: \"0\" (from .0)\n // We need to reconstruct the original value by concatenating all nodes\n const parts: string[] = []\n\n for (const node of firstNode.nodes) {\n switch (node.type) {\n case 'tag':\n parts.push(asTagNode(node).value)\n break\n case 'class':\n // Class nodes represent .className in CSS, so we need to add the dot back\n parts.push('.' + node.value)\n break\n case 'id':\n // ID nodes represent #idName in CSS, so we need to add the hash back\n parts.push('#' + node.value)\n break\n case 'string':\n parts.push(removeQuotes(asStringNode(node).value))\n break\n default:\n // For other node types, try to get the value property or convert to string\n /* c8 ignore next */\n parts.push(node.value ?? String(node))\n break\n }\n }\n\n specValue = parts.join('')\n return { specValue }\n}\n\n/**\n * :spec Pseudo-Selector, matches edges where edge.spec.bareSpec equals the provided value.\n *\n * Examples:\n * - :spec(\"*\") matches edges with a package specifier equal to \"*\"\n * - :spec(^1.0.0) matches edges with a package specifier equal to \"^1.0.0\"\n * - :spec(\"catalog:\") matches edges with a package specifier equal to \"catalog:\"\n * - :spec(\"workspace:dev\") matches edges with a package specifier equal to \"workspace:dev\"\n */\nexport const spec = async (state: ParserState) => {\n let internals\n try {\n internals = parseInternals(\n asPostcssNodeWithChildren(state.current).nodes,\n )\n } catch (err) {\n throw error('Failed to parse :spec selector', {\n cause: err,\n })\n }\n\n const { specValue } = internals\n\n for (const edge of state.partial.edges) {\n if (edge.spec.bareSpec !== specValue) {\n removeEdge(state, edge)\n }\n }\n\n // Clean up unlinked nodes after removing edges\n removeUnlinkedNodes(state)\n\n return state\n}\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **shrinkwrap** report alert.\n */\nexport const shrinkwrap = createSecuritySelectorFilter(\n 'shrinkwrap',\n 'shrinkwrap',\n)\n", "import { error } from '@vltpkg/error-cause'\nimport { asError } from '@vltpkg/types'\nimport {\n asPostcssNodeWithChildren,\n asStringNode,\n asTagNode,\n isStringNode,\n isTagNode,\n} from '@vltpkg/dss-parser'\nimport {\n assertSecurityArchive,\n removeDanglingEdges,\n removeNode,\n removeQuotes,\n} from './helpers.ts'\nimport type { ParserState } from '../types.ts'\nimport type { PostcssNode } from '@vltpkg/dss-parser'\n\nexport type SquatKinds = '0' | '2' | 'critical' | 'medium' | undefined\n\nexport type SquatAlertTypes =\n | 'didYouMean'\n | 'gptDidYouMean'\n | undefined\n\nexport type SquatComparator = '>' | '<' | '>=' | '<=' | undefined\n\nconst kindsMap = new Map<SquatKinds, SquatAlertTypes>([\n ['critical', 'didYouMean'],\n ['medium', 'gptDidYouMean'],\n ['0', 'didYouMean'],\n ['2', 'gptDidYouMean'],\n [undefined, undefined],\n])\n\n// Map numerical values to their respective kinds for comparison operations\nconst kindLevelMap = new Map<SquatKinds, number>([\n ['critical', 0],\n ['medium', 2],\n ['0', 0],\n ['2', 2],\n])\n\nconst kinds = new Set(kindsMap.keys())\n\nexport const isSquatKind = (value?: string): value is SquatKinds =>\n kinds.has(value as SquatKinds)\n\nexport const asSquatKind = (value?: string): SquatKinds => {\n if (!isSquatKind(value)) {\n throw error('Expected a valid squat kind', {\n found: value,\n validOptions: Array.from(kinds),\n })\n }\n return value\n}\n\nexport const parseInternals = (\n nodes: PostcssNode[],\n): {\n kind: SquatKinds\n comparator: SquatComparator\n} => {\n let kind: SquatKinds\n let comparator: SquatComparator\n\n let kindValue = ''\n if (isStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])) {\n kindValue = removeQuotes(\n asStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n .value,\n )\n } else if (\n isTagNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n ) {\n kindValue = asTagNode(\n asPostcssNodeWithChildren(nodes[0]).nodes[0],\n ).value\n }\n\n // Extract comparator if present\n if (kindValue.startsWith('>=')) {\n comparator = '>='\n kindValue = kindValue.substring(2)\n } else if (kindValue.startsWith('<=')) {\n comparator = '<='\n kindValue = kindValue.substring(2)\n } else if (kindValue.startsWith('>')) {\n comparator = '>'\n kindValue = kindValue.substring(1)\n } else if (kindValue.startsWith('<')) {\n comparator = '<'\n kindValue = kindValue.substring(1)\n }\n\n // Parse kind value\n if (kindValue) {\n if (isSquatKind(kindValue)) {\n kind = kindValue\n } else {\n throw error('Expected a valid squat kind for comparison', {\n found: kindValue,\n validOptions: Array.from(kinds),\n })\n }\n }\n\n return { kind, comparator }\n}\n\nexport const squat = async (state: ParserState) => {\n assertSecurityArchive(state, 'squat')\n\n let internals\n try {\n internals = parseInternals(\n asPostcssNodeWithChildren(state.current).nodes,\n )\n } catch (err) {\n if (asError(err).message === 'Expected a query node') {\n // No parameters provided - pseudo state form: match ANY squat level\n internals = { kind: undefined, comparator: undefined }\n } else {\n throw error('Failed to parse :squat selector', { cause: err })\n }\n }\n\n const { kind, comparator } = internals\n\n // First pass: Remove nodes without security data\n for (const node of state.partial.nodes) {\n const report = state.securityArchive.get(node.id)\n // Always exclude nodes that don't have security data or alerts\n if (!report?.alerts || report.alerts.length === 0) {\n removeNode(state, node)\n }\n }\n\n // Second pass: Apply comparison filtering\n for (const node of state.partial.nodes) {\n const report = state.securityArchive.get(node.id)\n\n // Skip if report is undefined\n // (should never happen since we filtered above)\n /* c8 ignore next - impossible */\n if (!report) continue\n\n // At this point we know report exists and has alerts\n let exclude = true\n\n if (kind === undefined && comparator === undefined) {\n // Pseudo state form: match ANY squat level\n exclude = !report.alerts.some(alert =>\n [...kindsMap.values()].includes(\n alert.type as SquatAlertTypes,\n ),\n )\n } else if (comparator) {\n // Get the value to compare against\n const kindLevel = kindLevelMap.get(kind)\n /* c8 ignore next - impossible */\n if (kindLevel === undefined) break\n\n // For each alert, check if it matches the comparison criteria\n let matchesComparison = false\n for (const alert of report.alerts) {\n // Get the alert type\n const alertType = alert.type\n\n // Find the corresponding kind for this alert type\n const alertLevelKey = [...kindsMap.entries()].find(\n ([_, value]) => value === alertType,\n )?.[0]\n\n if (alertLevelKey) {\n // Get the numeric level for this alert\n const alertLevel = kindLevelMap.get(alertLevelKey)\n /* c8 ignore next - impossible */\n if (alertLevel === undefined) continue\n\n // Apply the comparison based on the comparator\n switch (comparator) {\n case '>':\n if (alertLevel > kindLevel) {\n matchesComparison = true\n }\n break\n case '<':\n if (alertLevel < kindLevel) {\n matchesComparison = true\n }\n break\n case '>=':\n if (alertLevel >= kindLevel) {\n matchesComparison = true\n }\n break\n case '<=':\n if (alertLevel <= kindLevel) {\n matchesComparison = true\n }\n break\n }\n\n // If we found a match, we can stop checking other alerts\n if (matchesComparison) break\n }\n }\n\n // Exclude the node if it doesn't match the comparison\n exclude = !matchesComparison\n } else {\n // Original exact match behavior\n const alertName = kindsMap.get(kind)\n exclude = !report.alerts.some(alert => alert.type === alertName)\n }\n\n if (exclude) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **suspiciousStarActivity** report alert.\n */\nexport const suspicious = createSecuritySelectorFilter(\n 'suspicious',\n 'suspiciousStarActivity',\n)\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **telemetry** report alert.\n */\nexport const tracker = createSecuritySelectorFilter(\n 'tracker',\n 'telemetry',\n)\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **trivialPackage** report alert.\n */\nexport const trivial = createSecuritySelectorFilter(\n 'trivial',\n 'trivialPackage',\n)\n", "import { splitDepID } from '@vltpkg/dep-id/browser'\nimport {\n asPostcssNodeWithChildren,\n asTagNode,\n} from '@vltpkg/dss-parser'\nimport { removeDanglingEdges, removeNode } from './helpers.ts'\nimport type { ParserState } from '../types.ts'\n\n/**\n * :type(str) Pseudo-Element will match only nodes that are of\n * the same type as the value used. The type is determined by the\n * first part of the dependency ID.\n */\nexport const type = async (state: ParserState) => {\n const type = asPostcssNodeWithChildren(state.current)\n const selector = asPostcssNodeWithChildren(type.nodes[0])\n const name = asTagNode(selector.nodes[0]).value\n for (const node of state.partial.nodes) {\n const nodeType = splitDepID(node.id)[0]\n if (nodeType !== name) {\n removeNode(state, node)\n }\n }\n removeDanglingEdges(state)\n return state\n}\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **troll** report alert.\n */\nexport const undesirable = createSecuritySelectorFilter(\n 'undesirable',\n 'troll',\n)\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **newAuthor** report alert.\n */\nexport const unknown = createSecuritySelectorFilter(\n 'unknown',\n 'newAuthor',\n)\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **unmaintained** report alert.\n */\nexport const unmaintained = createSecuritySelectorFilter(\n 'unmaintained',\n 'unmaintained',\n)\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **unpopularPackage** report alert.\n */\nexport const unpopular = createSecuritySelectorFilter(\n 'unpopular',\n 'unpopularPackage',\n)\n", "import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **unstableOwnership** report alert.\n */\nexport const unstable = createSecuritySelectorFilter(\n 'unstable',\n 'unstableOwnership',\n)\n", "import type { ParserState } from '../types.ts'\nimport { removeNode } from './helpers.ts'\n\n/**\n * :workspace Pseudo-Selector will only match workspace dependencies.\n */\nexport const workspace = async (state: ParserState) => {\n // Filter out the root node and any nodes that are not marked as workspaces\n for (const node of state.partial.nodes) {\n if (!node.importer || node.mainImporter) {\n removeNode(state, node)\n }\n }\n\n // Clears up any edges that are not pointing to workspace nodes\n for (const edge of state.partial.edges) {\n if (edge.to?.importer && !edge.to.mainImporter) continue\n state.partial.edges.delete(edge)\n }\n\n return state\n}\n", "import { error } from '@vltpkg/error-cause'\nimport { removeDanglingEdges, removeNode } from './pseudo/helpers.ts'\nimport {\n asPostcssNodeWithChildren,\n asPseudoNode,\n isSelectorNode,\n} from '@vltpkg/dss-parser'\n\n// imported pseudo selectors\nimport { abandoned } from './pseudo/abandoned.ts'\nimport { attr } from './pseudo/attr.ts'\nimport { built } from './pseudo/built.ts'\nimport { confused } from './pseudo/confused.ts'\nimport { cve } from './pseudo/cve.ts'\nimport { cwe } from './pseudo/cwe.ts'\nimport { debug } from './pseudo/debug.ts'\nimport { deprecated } from './pseudo/deprecated.ts'\nimport { dev } from './pseudo/dev.ts'\nimport { dynamic } from './pseudo/dynamic.ts'\nimport { empty } from './pseudo/empty.ts'\nimport { entropic } from './pseudo/entropic.ts'\nimport { env } from './pseudo/env.ts'\nimport { evalParser } from './pseudo/eval.ts'\nimport { fs } from './pseudo/fs.ts'\nimport { hostContext } from './pseudo/host.ts'\nimport { license } from './pseudo/license.ts'\nimport { link } from './pseudo/link.ts'\nimport { malware } from './pseudo/malware.ts'\nimport { minified } from './pseudo/minified.ts'\nimport { missing } from './pseudo/missing.ts'\nimport { nativeParser } from './pseudo/native.ts'\nimport { network } from './pseudo/network.ts'\nimport { obfuscated } from './pseudo/obfuscated.ts'\nimport { optional } from './pseudo/optional.ts'\nimport { outdated } from './pseudo/outdated.ts'\nimport { overridden } from './pseudo/overridden.ts'\nimport { path } from './pseudo/path.ts'\nimport { peer } from './pseudo/peer.ts'\nimport { prerelease } from './pseudo/prerelease.ts'\nimport { published } from './pseudo/published.ts'\nimport { privateParser } from './pseudo/private.ts'\nimport { prod } from './pseudo/prod.ts'\nimport { root } from './pseudo/root.ts'\nimport { scanned } from './pseudo/scanned.ts'\nimport { score } from './pseudo/score.ts'\nimport { scripts } from './pseudo/scripts.ts'\nimport { shell } from './pseudo/shell.ts'\nimport { semverParser as semver } from './pseudo/semver.ts'\nimport { severity } from './pseudo/severity.ts'\nimport { spec } from './pseudo/spec.ts'\nimport { shrinkwrap } from './pseudo/shrinkwrap.ts'\nimport { squat } from './pseudo/squat.ts'\nimport { suspicious } from './pseudo/suspicious.ts'\nimport { tracker } from './pseudo/tracker.ts'\nimport { trivial } from './pseudo/trivial.ts'\nimport { type } from './pseudo/type.ts'\nimport { undesirable } from './pseudo/undesirable.ts'\nimport { unknown } from './pseudo/unknown.ts'\nimport { unmaintained } from './pseudo/unmaintained.ts'\nimport { unpopular } from './pseudo/unpopular.ts'\nimport { unstable } from './pseudo/unstable.ts'\nimport { workspace } from './pseudo/workspace.ts'\n\nimport type { EdgeLike, NodeLike } from '@vltpkg/types'\nimport type { ParserFn, ParserState } from './types.ts'\n\n/**\n * :has Pseudo-Selector, matches only nodes that have valid results\n * for its nested selector expressions.\n */\nconst has = async (state: ParserState) => {\n const top = asPostcssNodeWithChildren(state.current)\n const collectNodes = new Set<NodeLike>()\n const collectEdges = new Set<EdgeLike>()\n\n for (const node of top.nodes) {\n if (isSelectorNode(node)) {\n const nestedState = await state.walk({\n cancellable: state.cancellable,\n initial: {\n edges: new Set(state.initial.edges),\n nodes: new Set(state.initial.nodes),\n },\n current: node,\n walk: state.walk,\n collect: {\n edges: new Set(),\n nodes: new Set(),\n },\n partial: {\n edges: new Set(state.partial.edges),\n nodes: new Set(state.partial.nodes),\n },\n hostContexts: state.hostContexts,\n importers: state.importers,\n retries: state.retries,\n securityArchive: state.securityArchive,\n signal: state.signal,\n scopeIDs: state.scopeIDs,\n comment: state.comment,\n specificity: { ...state.specificity },\n })\n for (const n of nestedState.collect.nodes) {\n collectNodes.add(n)\n }\n for (const e of nestedState.partial.edges) {\n collectEdges.add(e)\n }\n }\n }\n\n // if the nested selector did not match anything, that means\n // no current node has any matches\n if (collectNodes.size === 0) {\n state.partial.edges.clear()\n state.partial.nodes.clear()\n return state\n }\n\n // handles transitive dependencies\n // compareNodes collects a list of all ancestor nodes\n // from the resulting nodes of the nested selector\n const compareNodes = new Set<NodeLike>()\n const traverse = new Set(collectNodes)\n for (const node of traverse) {\n for (const edge of node.edgesIn) {\n compareNodes.add(edge.from)\n if (edge.from.edgesIn.size) {\n traverse.add(edge.from)\n }\n }\n }\n\n // for each node in the current list checks to see if\n // it has a node in the resulting nested state that is\n // a transitive dependency / children.\n nodesLoop: for (const node of state.partial.nodes) {\n if (node.edgesOut.size === 0 || !compareNodes.has(node)) {\n removeNode(state, node)\n continue\n }\n\n for (const edge of node.edgesOut.values()) {\n if (collectEdges.has(edge)) {\n continue nodesLoop\n }\n }\n removeNode(state, node)\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n\n/**\n * :is Pseudo-selector, acts as a shortcut for writing more compact expressions\n * by allowing multiple nested selectors to match on the previous results.\n *\n * It also enables the loose parsing mode, skipping instead of erroring usage\n * of non-existing classes, identifiers, pseudo-classes, etc.\n */\nconst is = async (state: ParserState) => {\n const top = asPostcssNodeWithChildren(state.current)\n const collect = new Set()\n for (const node of top.nodes) {\n if (isSelectorNode(node)) {\n const nestedState = await state.walk({\n cancellable: state.cancellable,\n collect: {\n edges: new Set(),\n nodes: new Set(),\n },\n current: node,\n initial: state.initial,\n loose: true,\n partial: {\n nodes: new Set(state.partial.nodes),\n edges: new Set(state.partial.edges),\n },\n importers: state.importers,\n hostContexts: state.hostContexts,\n walk: state.walk,\n retries: state.retries,\n securityArchive: state.securityArchive,\n signal: state.signal,\n scopeIDs: state.scopeIDs,\n comment: state.comment,\n specificity: { ...state.specificity },\n })\n for (const n of nestedState.collect.nodes) {\n collect.add(n)\n }\n }\n }\n for (const node of state.partial.nodes) {\n if (!collect.has(node)) {\n removeNode(state, node)\n }\n }\n return state\n}\n\n/**\n * :not Pseudo-class, serves to create negate expressions, anything that\n * matches selectors declared inside the `:not()` expression is going to be\n * filtered out in the final result.\n */\nconst not = async (state: ParserState) => {\n const top = asPostcssNodeWithChildren(state.current)\n const collect = new Set()\n for (const node of top.nodes) {\n if (isSelectorNode(node)) {\n const nestedState = await state.walk({\n cancellable: state.cancellable,\n collect: {\n edges: new Set(),\n nodes: new Set(),\n },\n current: node,\n initial: state.initial,\n partial: {\n nodes: new Set(state.partial.nodes),\n edges: new Set(state.partial.edges),\n },\n importers: state.importers,\n hostContexts: state.hostContexts,\n walk: state.walk,\n retries: state.retries,\n securityArchive: state.securityArchive,\n signal: state.signal,\n scopeIDs: state.scopeIDs,\n comment: state.comment,\n specificity: { ...state.specificity },\n })\n for (const n of nestedState.collect.nodes) {\n collect.add(n)\n }\n /* c8 ignore start - should be impossible */\n } else {\n throw error('Error parsing :not() selectors', {\n wanted: { type: 'selector' },\n found: node,\n })\n }\n /* c8 ignore stop */\n }\n for (const node of state.partial.nodes) {\n if (collect.has(node)) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n\n/**\n * :project Pseudo-Class, matches only graph importers (e.g: the\n * root node along with any configured workspace)\n */\nconst project = async (state: ParserState) => {\n for (const node of state.partial.nodes) {\n if (!node.importer) {\n removeNode(state, node)\n }\n }\n for (const edge of state.partial.edges) {\n if (!edge.to?.importer) {\n state.partial.edges.delete(edge)\n }\n }\n return state\n}\n\n/**\n * :scope Pseudo-Element, returns only the nodes that match the provided scopeIDs\n * from the Query.search method.\n */\nconst scope = async (state: ParserState) => {\n const scopeIDSet = new Set(state.scopeIDs)\n\n for (const node of state.partial.nodes) {\n if (!scopeIDSet.has(node.id)) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n\nconst pseudoSelectors = new Map<string, ParserFn>(\n Object.entries({\n abandoned,\n attr,\n built,\n confused,\n cve,\n cwe,\n debug,\n deprecated,\n dev,\n dynamic,\n eval: evalParser,\n empty,\n entropic,\n env,\n fs,\n has,\n host: hostContext,\n is,\n license,\n link,\n malware,\n minified,\n missing,\n native: nativeParser,\n network,\n not,\n obfuscated,\n optional,\n outdated,\n overridden,\n path,\n peer,\n prerelease,\n published,\n private: privateParser,\n prod,\n project,\n root,\n scanned,\n scope,\n score,\n scripts,\n semver,\n sev: severity,\n spec,\n severity,\n shell,\n shrinkwrap,\n squat,\n suspicious,\n tracker,\n trivial,\n type,\n undesirable,\n unknown,\n unmaintained,\n unpopular,\n unstable,\n v: semver,\n workspace,\n }),\n)\n\n/**\n * Parsers the `pseudo` node types.\n */\nexport const pseudo = async (state: ParserState) => {\n await state.cancellable()\n\n const curr = asPseudoNode(state.current)\n const parserFn =\n curr.value && pseudoSelectors.get(curr.value.slice(1))\n\n if (!parserFn) {\n if (state.loose) {\n state.partial.edges.clear()\n state.partial.nodes.clear()\n return state\n }\n\n throw error(`Unsupported pseudo-class: ${state.current.value}`, {\n found: state.current,\n })\n }\n\n const result = await parserFn(state)\n\n // Increment the commonCounter for specificity, except for\n // nesting selectors which don't contribute to specificity\n const pseudoValue = curr.value.slice(1)\n if (\n pseudoValue &&\n pseudoValue !== 'not' &&\n pseudoValue !== 'is' &&\n pseudoValue !== 'has'\n ) {\n result.specificity.commonCounter += 1\n }\n\n return result\n}\n", "import { error } from '@vltpkg/error-cause'\nimport { joinDepIDTuple } from '@vltpkg/dep-id/browser'\nimport {\n parse,\n isPostcssNodeWithChildren,\n asPostcssNodeWithChildren,\n isSelectorNode,\n isPseudoNode,\n isIdentifierNode,\n isAttributeNode,\n} from '@vltpkg/dss-parser'\nimport { attribute } from './attribute.ts'\nimport { combinator } from './combinator.ts'\nimport { id } from './id.ts'\nimport { pseudo } from './pseudo.ts'\nimport type { EdgeLike, NodeLike } from '@vltpkg/types'\nimport type { SecurityArchiveLike } from '@vltpkg/security-archive'\nimport type {\n PostcssNode,\n PostcssNodeWithChildren,\n} from '@vltpkg/dss-parser'\nimport type {\n HostContextsMap,\n ParsedSelectorToken,\n ParserState,\n ParserFn,\n QueryResponse,\n QueryResponseNode,\n QueryResponseEdge,\n} from './types.ts'\nimport type { DepID } from '@vltpkg/dep-id'\n\nexport * from './types.ts'\n\nexport type SearchOptions = {\n signal: AbortSignal\n scopeIDs?: DepID[]\n}\n\nconst noopFn = async (state: ParserState) => state\n\nconst selectors = {\n attribute,\n /* c8 ignore start */\n class: async (state: ParserState) => {\n throw error('Unsupported selector', { found: state.current })\n },\n /* c8 ignore end */\n combinator,\n comment: async (state: ParserState) => {\n if (state.current.value && !state.comment) {\n const commentValue = state.current.value\n const cleanComment = commentValue\n .replace(/^\\/\\*/, '')\n .replace(/\\*\\/$/, '')\n .trim()\n state.comment = cleanComment\n }\n return state\n },\n id,\n nesting: noopFn,\n pseudo,\n root: noopFn,\n selector: async (state: ParserState) => {\n state.partial.nodes = new Set(state.initial.nodes)\n state.partial.edges = new Set(state.initial.edges)\n return state\n },\n string: async (state: ParserState) => {\n throw error('Unsupported selector', { found: state.current })\n },\n tag: async (state: ParserState) => {\n if (state.current.value !== '{' && state.current.value !== '}') {\n throw error('Unsupported selector', { found: state.current })\n }\n return state\n },\n universal: noopFn,\n}\nconst selectorsMap = new Map<string, ParserFn>(\n Object.entries(selectors),\n)\n\nexport const walk = async (\n state: ParserState,\n): Promise<ParserState> => {\n await state.cancellable()\n\n const parserFn = selectorsMap.get(state.current.type)\n\n if (!parserFn) {\n if (state.loose) {\n return state\n }\n\n throw error(\n `Missing parser for query node: ${state.current.type}`,\n {\n found: state.current,\n },\n )\n }\n state = await parserFn(state)\n\n // pseudo selectors handle their own sub selectors\n if (\n isPostcssNodeWithChildren(state.current) &&\n state.current.type !== 'pseudo'\n ) {\n const node: PostcssNodeWithChildren = asPostcssNodeWithChildren(\n state.current,\n )\n\n if (node.nodes.length) {\n for (let i = 0; i < node.nodes.length; i++) {\n const current = node.nodes[i]\n /* c8 ignore next -- impossible but TS doesn't know that */\n if (!current) continue\n\n const childState: ParserState = {\n ...state,\n current,\n next: node.nodes[i + 1],\n prev: node.nodes[i - 1],\n }\n state = await walk(childState)\n }\n }\n\n if (isSelectorNode(node)) {\n for (const edge of state.partial.edges) {\n state.collect.edges.add(edge)\n }\n for (const node of state.partial.nodes) {\n state.collect.nodes.add(node)\n }\n }\n }\n return state\n}\n\nexport type QueryOptions = {\n edges: Set<EdgeLike>\n nodes: Set<NodeLike>\n importers: Set<NodeLike>\n retries?: number\n securityArchive: SecurityArchiveLike | undefined\n hostContexts?: HostContextsMap\n}\n\n// A list of known security selectors that rely on\n// data from the security-archive in order to work\nconst securitySelectors = new Set([\n ':abandoned',\n ':confused',\n ':cve',\n ':cwe',\n ':debug',\n ':deprecated',\n ':dynamic',\n ':entropic',\n ':env',\n ':eval',\n ':fs',\n ':license',\n ':malware',\n ':minified',\n ':native',\n ':network',\n ':obfuscated',\n ':scanned',\n ':score',\n ':sev',\n ':severity',\n ':shell',\n ':shrinkwrap',\n ':squat',\n ':suspicious',\n ':tracker',\n ':trivial',\n ':undesirable',\n ':unknown',\n ':unmaintained',\n ':unpopular',\n ':unstable',\n])\n\nconst setMethodToJSON = (node: QueryResponseNode) => {\n const { toJSON } = node\n const insights = node.insights\n node.toJSON = () => ({\n ...toJSON.call(node),\n insights,\n })\n}\n\n/**\n * The Query class is used to search the graph for nodes and edges\n * using the Dependency Selector Syntax (DSS).\n */\nexport class Query {\n #cache: Map<string, QueryResponse>\n #edges: Set<EdgeLike>\n #nodes: Set<NodeLike>\n #importers: Set<NodeLike>\n #retries: number\n #securityArchive: SecurityArchiveLike | undefined\n #hostContexts: HostContextsMap | undefined\n\n /**\n * Helper method to determine if a given query string is using any of\n * the known security selectors. This is useful so that operations can\n * skip hydrating the security archive if it's not needed.\n */\n static hasSecuritySelectors(query: string): boolean {\n for (const selector of securitySelectors) {\n if (query.includes(selector)) {\n return true\n }\n }\n return false\n }\n\n /**\n * Sorts an array of QueryResponse objects by specificity. Objects with\n * higher idCounter values come first, if idCounter values are equal,\n * then objects with higher commonCounter values come first. Otherwise,\n * the original order is preserved.\n */\n static specificitySort(\n responses: QueryResponse[],\n ): QueryResponse[] {\n return [...responses].sort((a, b) => {\n // First compare by idCounter (higher comes first)\n if (a.specificity.idCounter !== b.specificity.idCounter) {\n return b.specificity.idCounter - a.specificity.idCounter\n }\n\n // If idCounter values are equal, compare by commonCounter\n if (\n a.specificity.commonCounter !== b.specificity.commonCounter\n ) {\n return (\n b.specificity.commonCounter - a.specificity.commonCounter\n )\n }\n\n // If both counters are equal, preserve original order\n return 0\n })\n }\n\n constructor({\n edges,\n nodes,\n importers,\n retries,\n securityArchive,\n hostContexts,\n }: QueryOptions) {\n this.#cache = new Map()\n this.#edges = edges\n this.#nodes = nodes\n this.#importers = importers\n this.#retries = retries ?? 3\n this.#securityArchive = securityArchive\n this.#hostContexts = hostContexts\n }\n\n #getQueryResponseEdges(_edges: Set<EdgeLike>): QueryResponseEdge[] {\n return Array.from(_edges) as QueryResponseEdge[]\n }\n\n #getQueryResponseNodes(_nodes: Set<NodeLike>): QueryResponseNode[] {\n const nodes = Array.from(_nodes) as QueryResponseNode[]\n for (const node of nodes) {\n const securityArchiveEntry = this.#securityArchive?.get(node.id)\n\n // if a security archive entry is not found then the insights object\n // should just be empty with scanned=false\n if (!securityArchiveEntry) {\n node.insights = {\n scanned: false,\n }\n\n setMethodToJSON(node)\n continue\n }\n\n // if a security archive entry is found then we can populate the insights\n node.insights = {\n scanned: true,\n score: securityArchiveEntry.score,\n abandoned: securityArchiveEntry.alerts.some(\n i => i.type === 'missingAuthor',\n ),\n confused: securityArchiveEntry.alerts.some(\n i => i.type === 'manifestConfusion',\n ),\n cve: securityArchiveEntry.alerts\n .map(i => i.props?.cveId)\n .filter(i => i !== undefined),\n cwe: Array.from(\n new Set(\n securityArchiveEntry.alerts\n .filter(i => i.props?.cveId)\n .flatMap(i => i.props?.cwes?.map(j => j.id)),\n ),\n ) as `CWE-${string}`[],\n debug: securityArchiveEntry.alerts.some(\n i => i.type === 'debugAccess',\n ),\n deprecated: securityArchiveEntry.alerts.some(\n i => i.type === 'deprecated',\n ),\n dynamic: securityArchiveEntry.alerts.some(\n i => i.type === 'dynamicRequire',\n ),\n entropic: securityArchiveEntry.alerts.some(\n i => i.type === 'highEntropyStrings',\n ),\n env: securityArchiveEntry.alerts.some(\n i => i.type === 'envVars',\n ),\n eval: securityArchiveEntry.alerts.some(\n i => i.type === 'usesEval',\n ),\n fs: securityArchiveEntry.alerts.some(\n i => i.type === 'filesystemAccess',\n ),\n license: {\n unlicensed: securityArchiveEntry.alerts.some(\n i => i.type === 'explicitlyUnlicensedItem',\n ),\n misc: securityArchiveEntry.alerts.some(\n i => i.type === 'miscLicenseIssues',\n ),\n restricted: securityArchiveEntry.alerts.some(\n i => i.type === 'nonpermissiveLicense',\n ),\n ambiguous: securityArchiveEntry.alerts.some(\n i => i.type === 'ambiguousClassifier',\n ),\n copyleft: securityArchiveEntry.alerts.some(\n i => i.type === 'copyleftLicense',\n ),\n unknown: securityArchiveEntry.alerts.some(\n i => i.type === 'unidentifiedLicense',\n ),\n none: securityArchiveEntry.alerts.some(\n i => i.type === 'noLicenseFound',\n ),\n exception: securityArchiveEntry.alerts.some(\n i => i.type === 'licenseException',\n ),\n },\n malware: {\n low: securityArchiveEntry.alerts.some(\n i => i.type === 'gptAnomaly',\n ),\n medium: securityArchiveEntry.alerts.some(\n i => i.type === 'gptSecurity',\n ),\n high: securityArchiveEntry.alerts.some(\n i => i.type === 'gptMalware',\n ),\n critical: securityArchiveEntry.alerts.some(\n i => i.type === 'malware',\n ),\n },\n minified: securityArchiveEntry.alerts.some(\n i => i.type === 'minifiedFile',\n ),\n native: securityArchiveEntry.alerts.some(\n i => i.type === 'hasNativeCode',\n ),\n network: securityArchiveEntry.alerts.some(\n i => i.type === 'networkAccess',\n ),\n obfuscated: securityArchiveEntry.alerts.some(\n i => i.type === 'obfuscatedFile',\n ),\n scripts: securityArchiveEntry.alerts.some(\n i => i.type === 'installScripts',\n ),\n severity: {\n low: securityArchiveEntry.alerts.some(\n i => i.type === 'mildCVE',\n ),\n medium: securityArchiveEntry.alerts.some(\n i => i.type === 'potentialVulnerability',\n ),\n high: securityArchiveEntry.alerts.some(\n i => i.type === 'cve',\n ),\n critical: securityArchiveEntry.alerts.some(\n i => i.type === 'criticalCVE',\n ),\n },\n shell: securityArchiveEntry.alerts.some(\n i => i.type === 'shellAccess',\n ),\n shrinkwrap: securityArchiveEntry.alerts.some(\n i => i.type === 'shrinkwrap',\n ),\n squat: {\n medium: securityArchiveEntry.alerts.some(\n i => i.type === 'gptDidYouMean',\n ),\n critical: securityArchiveEntry.alerts.some(\n i => i.type === 'didYouMean',\n ),\n },\n suspicious: securityArchiveEntry.alerts.some(\n i => i.type === 'suspiciousStarActivity',\n ),\n tracker: securityArchiveEntry.alerts.some(\n i => i.type === 'telemetry',\n ),\n trivial: securityArchiveEntry.alerts.some(\n i => i.type === 'trivialPackage',\n ),\n undesirable: securityArchiveEntry.alerts.some(\n i => i.type === 'troll',\n ),\n unknown: securityArchiveEntry.alerts.some(\n i => i.type === 'newAuthor',\n ),\n unmaintained: securityArchiveEntry.alerts.some(\n i => i.type === 'unmaintained',\n ),\n unpopular: securityArchiveEntry.alerts.some(\n i => i.type === 'unpopularPackage',\n ),\n unstable: securityArchiveEntry.alerts.some(\n i => i.type === 'unstableOwnership',\n ),\n }\n\n setMethodToJSON(node)\n }\n return nodes\n }\n\n /**\n * Search the graph for nodes and edges that match the given query.\n */\n async search(\n query: string,\n {\n signal,\n scopeIDs = [joinDepIDTuple(['file', '.'])],\n }: SearchOptions,\n ): Promise<QueryResponse> {\n if (!query)\n return {\n edges: [],\n nodes: [],\n importers: [],\n comment: '',\n specificity: { idCounter: 0, commonCounter: 0 },\n }\n\n const cachedResult = this.#cache.get(query)\n if (cachedResult) {\n return cachedResult\n }\n\n const nodes = this.#nodes\n const edges = this.#edges\n const importers = this.#importers\n\n // includes virtual workspace edges in the searched edges\n for (const importer of importers) {\n if (!importer.workspaces) continue\n for (const edge of importer.workspaces.values()) {\n edges.add(edge)\n }\n }\n\n // parse the query string into AST\n const current = parse(query)\n // set loose mode for the entire parse in case there are multiple selectors\n // so that using invalid pseudo selectors or other query language parser\n // errors won't throw an error,\n // e.g: `:root > *, #a, :foo` still returns results for `:root > ` and `#a`\n // while :foo is ignored\n const loose = asPostcssNodeWithChildren(current).nodes.length > 1\n // builds initial state and walks over it,\n // retrieving the collected result\n const {\n collect,\n comment,\n importers: stateResultImporters,\n specificity,\n } = await walk({\n cancellable: async () => {\n await new Promise(resolve => {\n setTimeout(resolve, 0)\n })\n signal.throwIfAborted()\n },\n current,\n initial: {\n nodes: new Set(nodes),\n edges: new Set(edges),\n },\n collect: {\n nodes: new Set<NodeLike>(),\n edges: new Set<EdgeLike>(),\n },\n comment: '',\n loose,\n importers,\n partial: { nodes, edges },\n retries: this.#retries,\n signal,\n securityArchive: this.#securityArchive,\n scopeIDs,\n walk,\n specificity: { idCounter: 0, commonCounter: 0 },\n hostContexts: this.#hostContexts,\n })\n\n const res: QueryResponse = {\n edges: this.#getQueryResponseEdges(collect.edges),\n nodes: this.#getQueryResponseNodes(collect.nodes),\n importers: this.#getQueryResponseNodes(stateResultImporters),\n comment,\n specificity,\n }\n this.#cache.set(query, res)\n return res\n }\n\n /**\n * Parses a query string in order to retrieve an array of tokens.\n */\n static getQueryTokens(query: string): ParsedSelectorToken[] {\n if (!query) return []\n\n const tokens: ParsedSelectorToken[] = []\n\n const ast = (q: string) => {\n try {\n return parse(q)\n } catch (_e) {\n return ast(q.slice(0, -1))\n }\n }\n\n const processNode = (node: PostcssNode) => {\n for (const key of selectorsMap.keys()) {\n if (node.type === key && node.type !== 'root') {\n let token = `${node.spaces.before}${node.value}${node.spaces.after}`\n\n if (isIdentifierNode(node)) {\n token = `${node.spaces.before}#${node.value}${node.spaces.after}`\n } else if (isSelectorNode(node)) {\n token = `${node.spaces.before},${node.spaces.after}`\n } else if (isAttributeNode(node)) {\n token = String(\n node.source?.start?.column &&\n node.source.end?.column &&\n `${node.spaces.before}${query.slice(node.source.start.column - 1, node.source.end.column)}${node.spaces.after}`,\n )\n }\n\n if (\n isPostcssNodeWithChildren(node) &&\n isPseudoNode(node) &&\n node.nodes.length\n ) {\n token = String(token.split('(')[0])\n token += '('\n }\n\n if (\n !isSelectorNode(node) ||\n node.parent?.nodes.indexOf(node) !== 0\n ) {\n tokens.push({\n ...node,\n token,\n } as ParsedSelectorToken)\n }\n }\n }\n if (isPostcssNodeWithChildren(node)) {\n for (const child of node.nodes) {\n processNode(child)\n }\n if (isPseudoNode(node) && node.nodes.length) {\n tokens.push({\n ...node,\n token: ')' + node.spaces.after,\n type: 'pseudo',\n } as ParsedSelectorToken)\n }\n }\n }\n\n processNode(ast(query))\n return tokens\n }\n}\n", "import { DatabaseSync } from 'node:sqlite'\nimport { mkdirSync } from 'node:fs'\nimport { dirname } from 'node:path'\nimport { LRUCache } from 'lru-cache'\nimport pRetry, { AbortError } from 'p-retry'\nimport { loadPackageJson } from 'package-json-from-dist'\nimport { asDepID, splitDepID, baseDepID } from '@vltpkg/dep-id'\nimport { error } from '@vltpkg/error-cause'\nimport { XDG } from '@vltpkg/xdg'\nimport { asPackageReportData } from './types.ts'\nimport type { DepID } from '@vltpkg/dep-id'\nimport type { NodeLike } from '@vltpkg/types'\nimport type {\n PackageReportData,\n SecurityArchiveLike,\n SecurityArchiveRefreshOptions,\n} from './types.ts'\n\nexport * from './types.ts'\n\nconst SOCKET_API_V0_URL = 'https://api.socket.dev/v0/purl?alerts=true'\nconst SOCKET_PUBLIC_API_TOKEN =\n 'sktsec_t_--RAN5U4ivauy4w37-6aoKyYPDt5ZbaT5JBVMqiwKo_api'\n\nexport const targetSecurityRegisty = 'https://registry.npmjs.org/'\n\nexport type JSONItemResponse = {\n namespace?: `@{string}`\n name: string\n version: string\n score: {\n overall: number\n license: number\n maintenance: number\n quality: number\n supplyChain: number\n vulnerability: number\n }\n}\n\nexport type DBReadEntry = {\n depID: string\n now: number\n report: string\n start: number\n ttl: number\n}\n\nexport type DBWriteEntry = [string, string, number, number]\n\nexport type SecurityArchiveOptions = LRUCache.OptionsBase<\n DepID,\n PackageReportData,\n unknown\n> & {\n /**\n * Security archive does not supports a fetch-on-demand model.\n */\n fetchMethod?: undefined\n /**\n * An optional value for the path in which to store the sqlite db.\n */\n path?: string\n /**\n * Number of retries attempts to reach the remote security API.\n */\n retries?: number\n}\n\n/**\n * Only the public npm registry has information available in the\n * socket.dev API. This function checks if a given depID is pointing\n * to the public npm registry and returns `true` if it does.\n */\nconst usesTargetRegistry = (node: NodeLike): boolean => {\n const depID = node.id\n const specOptions = node.options\n const [nodeType, nodeRegistry] = splitDepID(depID)\n\n if (nodeType !== 'registry') {\n return false\n }\n\n const reg = specOptions.registries?.[nodeRegistry]\n return reg === targetSecurityRegisty\n}\n\n// Loads the version number to be used in the User-Agent header\nexport const { version } = loadPackageJson(\n import.meta.filename,\n process.env.__VLT_INTERNAL_CLI_PACKAGE_JSON,\n) as {\n version: string\n}\n\n/**\n * A database of security information for given packages from a list of nodes.\n *\n * Using the SecurityArchive.refresh() method will update the local cache\n * with information from the socket.dev APIs or load from the local storage\n * if available. Information about package security is then available\n * using the SecurityArchive.get() method.\n */\nexport class SecurityArchive\n extends LRUCache<DepID, PackageReportData>\n implements SecurityArchiveLike\n{\n #expired = new Set<DepID>()\n #pUpdateExpired: Promise<void> | undefined\n #path: string\n #retries: number\n #nodesByName = new Map<string, Set<NodeLike>>()\n #nodesByID = new Map<DepID, NodeLike>()\n\n /**\n * True if the refresh process was successful and report data is available\n * for all public registry packages from the initial list of nodes.\n */\n ok = false\n\n /**\n * Creates a new security archive instance and starts the refresh process.\n */\n static async start(\n options: SecurityArchiveOptions & SecurityArchiveRefreshOptions,\n ) {\n const archive = new SecurityArchive(options)\n await archive.refresh(options)\n return archive\n }\n\n /**\n * By default, limits to 100K entries in the in-memory archive.\n */\n static get defaultMax() {\n return 100_000\n }\n\n /**\n * By default, entries are cached for 3 hours.\n */\n static get defaultTtl() {\n return 1000 * 60 * 60 * 3\n }\n\n constructor(options: SecurityArchiveOptions = {}) {\n super({\n max: SecurityArchive.defaultMax,\n ttl: SecurityArchive.defaultTtl,\n ...options,\n allowStale: true,\n })\n\n this.#path =\n options.path ?? new XDG('vlt').cache('security-archive.db')\n this.#retries = options.retries ?? 3\n }\n\n /**\n * Retrieves a node using its name and version.\n */\n #retrieveNodeByNameVersion(\n name: string,\n version: string,\n ): NodeLike | undefined {\n for (const node of this.#nodesByName.get(name) ?? []) {\n if (node.version === version) {\n return node\n }\n }\n }\n\n /**\n * Opens a connection to the database at the given path.\n */\n #openDatabase(): DatabaseSync {\n mkdirSync(dirname(this.#path), { recursive: true })\n const db = new DatabaseSync(this.#path)\n db.exec(\n 'CREATE TABLE IF NOT EXISTS cache ' +\n '(depID TEXT PRIMARY KEY, report TEXT, ttl INTEGER, start INTEGER) ' +\n // WITHOUT ROWID models a key=value storage,\n // enforcing depID must be unique and not null\n // while using less space and more efficient lookups\n // https://www.sqlite.org/withoutrowid.html\n 'WITHOUT ROWID',\n )\n db.exec('PRAGMA journal_mode = WAL')\n db.exec('PRAGMA synchronous = NORMAL')\n return db\n }\n\n /**\n * Loads all valid items found in the database into the in-memory cache.\n */\n #loadItemsFromDatabase(db: DatabaseSync, nodes: NodeLike[]): void {\n const depIDs: string[] = []\n for (const node of nodes) {\n depIDs.push(`'${baseDepID(node.id)}'`)\n }\n // retrieves from the db packages using their dep-id reference\n // and only include entries that have a valid TTL value\n const dbRead = db.prepare(\n 'SELECT depID, report, start, ttl, ' +\n `(SELECT UNIXEPOCH('subsecond') * 1000) as now ` +\n 'FROM cache ' +\n `WHERE depID IN (${depIDs.join(',')})`,\n )\n // reset the list of expired entries\n this.#expired.clear()\n for (const entry of dbRead.all() as DBReadEntry[]) {\n const { depID, now, report, start, ttl } = entry\n const id = baseDepID(asDepID(depID))\n try {\n this.set(id, asPackageReportData(JSON.parse(report)), {\n ttl,\n start,\n })\n // stale values are queued up as expired for revalidation\n if (start + ttl < now) {\n this.#expired.add(id)\n }\n } catch {\n // prune any invalid entries from the database\n db.prepare('DELETE FROM cache WHERE depID = ?').run(depID)\n }\n }\n // TODO: we need to move this to a detached process in order for the\n // cli commands that make usage of the security-archive, e.g: vlt ls,\n // vlt query to not hang while waiting for stale-while-revalidate\n // request to finish and close the db connection\n this.#pUpdateExpired = this.#updateExpired(db)\n }\n\n /**\n * Updates the database with renewed entries for expired packages.\n */\n async #updateExpired(db: DatabaseSync): Promise<void> {\n const expiredQueue = new Set<Record<'purl', string>>()\n for (const depID of this.#expired) {\n const node = this.#nodesByID.get(baseDepID(depID))\n\n /* c8 ignore start */\n if (!node?.version) {\n // skip any missing node or nodes without a version, this\n // should not happen, but some optional dependencies might\n // end up in this state when reading from the lockfile\n continue\n }\n /* c8 ignore stop */\n\n const purl = `pkg:npm/${node.name}@${node.version}`\n expiredQueue.add({ purl })\n }\n if (expiredQueue.size > 0) {\n const res = await pRetry(\n () => this.#retrieveRemoteData(expiredQueue),\n { retries: this.#retries },\n )\n const ids = this.#loadFromNDJSON(res)\n this.#storeNewItemsToDatabase(db, ids)\n }\n }\n\n /**\n * Queues up all required packages that are missing from the archive.\n */\n #queueUpRequiredPackages(): Set<Record<'purl', string>> {\n const queue = new Set<Record<'purl', string>>()\n for (const node of this.#nodesByID.values()) {\n const normalizedId = baseDepID(node.id)\n // only queue up valid public registry\n // references that are missing from the archive\n // also skips any pkg marked as expired\n if (\n usesTargetRegistry(node) &&\n !this.has(normalizedId) &&\n !this.#expired.has(normalizedId)\n ) {\n const purl = `pkg:npm/${node.name}@${node.version}`\n queue.add({ purl })\n }\n }\n return queue\n }\n\n /**\n * Fetches security information from the socket.dev API.\n * Returns a string of NDJSON data.\n */\n async #retrieveRemoteData(\n queue: Set<Record<'purl', string>>,\n ): Promise<string> {\n // fetch information from the socket.dev API\n const req = await fetch(SOCKET_API_V0_URL, {\n method: 'POST',\n headers: {\n Authorization: `Basic ${Buffer.from(`${SOCKET_PUBLIC_API_TOKEN}:`).toString('base64url')}`,\n 'User-Agent': `@vltpkg/security-archive/${version}`,\n },\n body: JSON.stringify({\n components: Array.from(queue),\n }),\n })\n // on missing valid auth or API, it should abort the retry logic\n if (req.status === 404) {\n throw new AbortError('Missing API')\n }\n // on any other error throws an error that will trigger retry\n if (!req.ok || !(req.status >= 200 && req.status <= 299)) {\n throw error('Failed to fetch security data', { response: req })\n }\n\n const str = await req.text()\n return str.trim() + '\\n'\n }\n\n /**\n * Parses and load NDJSON data into the in-memory cache.\n * Returns a set of dep ids that were successfully loaded.\n */\n #loadFromNDJSON(str: string): Set<DepID> {\n // builds a set of dep ids that were successfully fetched and loaded\n const fetchedDepIDs = new Set<DepID>()\n const json = str.split('}\\n')\n for (const line of json) {\n if (!line.trim()) continue\n const data = JSON.parse(line + '}') as JSONItemResponse\n const scope = data.namespace ? `${data.namespace}/` : ''\n const name = `${scope}${data.name}`\n const node = this.#retrieveNodeByNameVersion(name, data.version)\n if (node) {\n const normalizedId = baseDepID(node.id)\n fetchedDepIDs.add(baseDepID(node.id))\n // Calculate average score from all score components\n const scoreComponents = [\n data.score.license,\n data.score.maintenance,\n data.score.quality,\n data.score.supplyChain,\n data.score.vulnerability,\n ]\n const newAverageScore = Number(\n (\n scoreComponents.reduce((sum, score) => sum + score, 0) /\n scoreComponents.length\n ).toFixed(2),\n )\n // Add average score to the score object\n const scoreWithNewAverage = {\n ...data.score,\n overall: newAverageScore,\n }\n this.set(\n normalizedId,\n asPackageReportData({\n ...data,\n score: scoreWithNewAverage,\n }),\n )\n } else {\n // eslint-disable-next-line no-console\n console.warn(\n `security-archive: failed to find node for ${scope}${data.name}@${data.version} found in the response.`,\n )\n }\n }\n return fetchedDepIDs\n }\n\n /**\n * Store new in-memory items to the database.\n */\n #storeNewItemsToDatabase(\n db: DatabaseSync,\n depIDs: Set<DepID>,\n ): void {\n const insertData: DBWriteEntry[] = []\n for (const depID of depIDs) {\n const entry = this.info(depID)\n if (entry?.start && entry.ttl) {\n insertData.push([\n depID,\n JSON.stringify(entry.value),\n entry.start,\n entry.ttl,\n ])\n }\n }\n const dbWrite = db.prepare(\n 'INSERT OR REPLACE INTO cache (depID, report, start, ttl) ' +\n 'VALUES (?, ?, ?, ?)',\n )\n for (const data of insertData) {\n dbWrite.run(...data)\n }\n }\n\n /**\n * Validates that all public-registry packages in the nodes\n * have a valid report data in the current in-memory cache.\n */\n #validateReportData() {\n for (const node of this.#nodesByID.values()) {\n if (usesTargetRegistry(node)) {\n if (!this.has(baseDepID(node.id))) {\n this.ok = false\n return\n }\n }\n }\n this.ok = true\n }\n\n /**\n * Starts the security archive by providing an array of {@link NodeLike} instances,\n * its registry-based nodes are going to be used as valid potential entries.\n *\n * Any entry that is missing from the persisted cached values are going\n * to be requested in a batch-request to the remote socket.dev API.\n */\n async refresh({ nodes }: SecurityArchiveRefreshOptions) {\n // should start by clearing the current in-memory cache\n this.clear()\n\n const db = this.#openDatabase()\n\n // indexes nodes by name and id for quick lookup\n this.#nodesByName.clear()\n this.#nodesByID.clear()\n for (const node of nodes) {\n /* c8 ignore start */\n const setByName =\n this.#nodesByName.get(node.name ?? '') ?? new Set()\n setByName.add(node)\n this.#nodesByName.set(node.name ?? '', setByName)\n /* c8 ignore stop */\n this.#nodesByID.set(baseDepID(node.id), node)\n }\n\n try {\n this.#loadItemsFromDatabase(db, nodes)\n\n const queue = this.#queueUpRequiredPackages()\n // only reach for the remote API if there are packages queued up\n if (queue.size > 0) {\n // Parse the response data\n const res = await pRetry(\n () => this.#retrieveRemoteData(queue),\n { retries: this.#retries },\n )\n const ids = this.#loadFromNDJSON(res)\n this.#storeNewItemsToDatabase(db, ids)\n }\n\n // validates the refresh process was successful\n this.#validateReportData()\n } finally {\n // TODO: once we move the stale-while-revalidate to a detached process\n // the this.#close method no longer needs to be async\n void this.#close(db)\n }\n }\n\n /**\n * Closes the database connection and cleans up the internal state.\n */\n async #close(db: DatabaseSync) {\n // the revalidation of stale entries might not yet be completed\n // so in case we have a pending promise for that, we need to wait\n await this.#pUpdateExpired\n // close db connection\n db.exec('PRAGMA optimize')\n db.close()\n // clean up internal state\n this.#expired.clear()\n this.#pUpdateExpired = undefined\n // TODO: at this point we could spawn a deref process to\n // remove entries with expired ttl values and vaccum the db\n }\n\n /**\n * Outputs the current in-memory cache as a JSON object.\n */\n toJSON() {\n const obj: Record<DepID, PackageReportData> = {}\n for (const [key, value] of this.dump()) {\n obj[key] = value.value\n }\n return obj\n }\n}\n", "import { error } from '@vltpkg/error-cause'\nimport type { DepID } from '@vltpkg/dep-id'\nimport type { NodeLike } from '@vltpkg/types'\n\n/**\n * Parameter options for initializing a security archive.\n */\nexport type SecurityArchiveRefreshOptions = {\n /**\n * A @link{GraphLike} instance to find what packages the\n * security archive should have.\n */\n nodes: NodeLike[]\n}\n\n/**\n * An interface for interacting with a security archive.\n */\nexport interface SecurityArchiveLike {\n get: (depId: DepID) => PackageReportData | undefined\n set: (depId: DepID, data: PackageReportData) => void\n delete: (depId: DepID) => void\n has: (depId: DepID) => boolean\n clear: () => void\n ok?: boolean\n}\n\nexport const isSecurityArchiveLike = (\n o: unknown,\n): o is SecurityArchiveLike =>\n typeof o === 'object' &&\n o != null &&\n 'get' in o &&\n 'set' in o &&\n 'delete' in o &&\n 'has' in o &&\n 'clear' in o\n\nexport const asSecurityArchiveLike = (\n o: unknown,\n): SecurityArchiveLike => {\n if (!isSecurityArchiveLike(o)) {\n throw error('Invalid security archive like', { found: o })\n }\n return o\n}\n\n/**\n * Package alert extra information.\n */\nexport type PackageAlertProps = {\n lastPublish: string\n cveId?: `CVE-${string}`\n cwes?: { id: `CWE-${string}` }[]\n}\n\n/**\n * A known alert for a given package.\n */\nexport type PackageAlert = {\n key: string\n type: string\n severity: 'low' | 'medium' | 'high' | 'critical'\n category: string\n props?: PackageAlertProps\n}\n\n/**\n * The scores for a given package\n */\nexport type PackageScore = {\n /**\n * The average of all score factors. (0-1)\n */\n overall: number\n /**\n * Score factors relating to package licensing (0-1)\n */\n license: number\n /**\n * Score factors relating to package maintenance (0-1)\n */\n maintenance: number\n /**\n * Score factors relating to code quality (0-1)\n */\n quality: number\n /**\n * Score factors relating to supply chain security (0-1)\n */\n supplyChain: number\n /**\n * Score factors relating to package vulnerabilities (0-1)\n */\n vulnerability: number\n}\n\n/**\n * The report data for a given package.\n */\nexport type PackageReportData = {\n id: string\n author: string[]\n size: number\n type: 'npm'\n namespace?: `@${string}`\n name: string\n version: string\n license: string\n alerts: PackageAlert[]\n score: PackageScore\n}\n\nexport const isPackageReportData = (\n o: unknown,\n): o is PackageReportData =>\n typeof o === 'object' &&\n o != null &&\n 'id' in o &&\n 'type' in o &&\n 'name' in o &&\n 'version' in o &&\n 'alerts' in o &&\n 'score' in o &&\n o.type === 'npm'\n\nexport const asPackageReportData = (\n o: unknown,\n): PackageReportData => {\n if (!isPackageReportData(o)) {\n throw error('Invalid package report data', { found: o })\n }\n return o\n}\n", "import type { DepID } from '@vltpkg/dep-id'\nimport { error } from '@vltpkg/error-cause'\nimport { Spec } from '@vltpkg/spec/browser'\nimport type { SpecOptions } from '@vltpkg/spec'\nimport type {\n DependencySaveType,\n DependencyTypeLong,\n DependencyTypeShort,\n Manifest,\n NodeLike,\n} from '@vltpkg/types'\nimport {\n dependencyTypes,\n longDependencyTypes,\n shortDependencyTypes,\n} from '@vltpkg/types'\n\nexport const isDependencyTypeShort = (\n obj: unknown,\n): obj is DependencyTypeShort =>\n shortDependencyTypes.has(obj as DependencyTypeShort)\n\nexport const isDependencySaveType = (\n obj: unknown,\n): obj is DependencyTypeShort =>\n shortDependencyTypes.has(obj as DependencyTypeShort) ||\n obj === 'implicit'\n\nexport const asDependencyTypeShort = (\n obj: unknown,\n): DependencyTypeShort => {\n if (!isDependencyTypeShort(obj)) {\n throw error('Invalid dependency type', {\n found: obj,\n validOptions: [...shortDependencyTypes],\n })\n }\n return obj\n}\n\n/**\n * Dependency entries info as defined in a package.json file.\n */\nexport type RawDependency = {\n name: string\n bareSpec: string\n type: DependencyTypeLong\n registry?: string\n}\n\n/**\n * Parsed dependency entries info.\n */\nexport type Dependency = {\n /**\n * The parsed {@link Spec} object describing the dependency requirements.\n */\n spec: Spec\n /**\n * The {@link DependencySaveType}, describing the way this dependency should\n * be saved back to the manifest.\n */\n type: DependencySaveType\n}\n\n/**\n * A `Map` in which keys are {@link DepID} linking to another `Map` in which\n * keys are the dependency names and values are {@link Dependency}. This\n * structure represents dependencies that need to be added to the importer\n * represented by {@link DepID}.\n *\n * The `modifiedDependencies` property can be used to indicate that there\n * are added dependencies to any of the importer nodes.\n */\nexport type AddImportersDependenciesMap = Map<\n DepID,\n Map<string, Dependency>\n> & { modifiedDependencies: boolean }\n\n/**\n * A `Map` object representing nodes to be removed from the ideal graph.\n * Each {@link DepID} key represents an importer node and the `Set` of\n * dependency names to be removed from its dependency list.\n *\n * The `modifiedDependencies` property can be used to indicate that there\n * are added dependencies to any of the importer nodes.\n */\nexport type RemoveImportersDependenciesMap = Map<\n DepID,\n Set<string>\n> & { modifiedDependencies: boolean }\n\nconst isObj = (o: unknown): o is Record<string, unknown> =>\n !!o && typeof o === 'object'\n\n// TODO: it would be nice to have a @vltpkg/spec.isSpec method\nexport const isDependency = (o: unknown): o is Dependency =>\n // TODO: it would be nice to have a @vltpkg/spec.isSpec method\n isObj(o) &&\n isObj(o.spec) &&\n !!o.spec.type &&\n isDependencySaveType(o.type)\n\nexport const asDependency = (obj: unknown): Dependency => {\n if (!isDependency(obj)) {\n throw error('Invalid dependency', { found: obj })\n }\n return obj\n}\n\n/**\n * Get the {@link DependencyTypeShort} from a {@link DependencyTypeLong}.\n */\nexport const shorten = (\n typeLong: DependencyTypeLong,\n name?: string,\n manifest?: Pick<Manifest, 'peerDependenciesMeta'> | null,\n): DependencyTypeShort => {\n const shortName = dependencyTypes.get(typeLong)\n if (!shortName) {\n throw error('Invalid dependency type name', {\n found: typeLong,\n validOptions: [...longDependencyTypes],\n })\n }\n if (shortName !== 'peer') {\n return shortName\n }\n if (\n name &&\n manifest?.peerDependenciesMeta?.[name]?.optional === true\n ) {\n return 'peerOptional'\n }\n return 'peer'\n}\n\nconst isStringArray = (a: unknown): a is string[] =>\n Array.isArray(a) && !a.some(b => typeof b !== 'string')\n\n/*\n * Retrieves a map of all dependencies, of all types, that can be iterated\n * on and consulted when parsing the directory contents of a given node.\n */\nexport const getRawDependencies = (node: NodeLike) => {\n const dependencies = new Map<string, RawDependency>()\n const bundleDeps: unknown = node.manifest?.bundleDependencies ?? []\n // if it's an importer, bundleDeps are just normal. if it's a dep,\n // then they're ignored entirely.\n const bundled =\n (\n !node.importer &&\n !node.id.startsWith('git') &&\n isStringArray(bundleDeps)\n ) ?\n new Set(bundleDeps)\n : new Set<string>()\n for (const depType of longDependencyTypes) {\n const obj: Record<string, string> | undefined =\n node.manifest?.[depType]\n // only care about devDeps for importers and git or symlink deps\n // technically this will also include devDeps for tarball file: specs,\n // but that is likely rare enough to not worry about too much.\n if (\n depType === 'devDependencies' &&\n !node.importer &&\n !node.id.startsWith('git') &&\n !node.id.startsWith('file')\n ) {\n continue\n }\n if (obj) {\n for (const [name, bareSpec] of Object.entries(obj)) {\n // if it's a bundled dependency, we just ignore it entirely.\n if (bundled.has(name)) continue\n dependencies.set(name, {\n name,\n type: depType,\n bareSpec,\n registry: node.registry,\n })\n }\n }\n }\n return dependencies\n}\n\n/**\n * Retrieves a map of all dependencies, of all types, that can be inferred\n * from a given node manifest, including missing dependencies.\n */\nexport const getDependencies = (\n node: NodeLike,\n options: SpecOptions,\n): Map<string, Dependency> => {\n const res = new Map<string, Dependency>()\n const dependencies = getRawDependencies(node)\n for (const { name, type, bareSpec } of dependencies.values()) {\n const depType = shorten(type, name, node.manifest)\n const spec = Spec.parse(name, bareSpec, {\n ...options,\n registry: node.registry,\n })\n res.set(name, {\n spec,\n type: depType,\n })\n }\n return res\n}\n", "import { getId, joinDepIDTuple, splitExtra } from '@vltpkg/dep-id'\nimport type { DepID } from '@vltpkg/dep-id'\nimport { error } from '@vltpkg/error-cause'\nimport { satisfies } from '@vltpkg/satisfies'\nimport { getOptions, Spec } from '@vltpkg/spec'\nimport type { SpecOptions } from '@vltpkg/spec'\nimport type {\n GraphLike,\n NodeLike,\n NormalizedManifest,\n DependencySaveType,\n} from '@vltpkg/types'\nimport type { Monorepo } from '@vltpkg/workspaces'\nimport { inspect } from 'node:util'\nimport type { InspectOptions } from 'node:util'\nimport { lockfileData } from './lockfile/save.ts'\nimport { Edge } from './edge.ts'\nimport { Node } from './node.ts'\nimport type { NodeOptions } from './node.ts'\nimport { resolveSaveType } from './resolve-save-type.ts'\nimport type { PeerContext } from './ideal/types.ts'\n\nconst kCustomInspect = Symbol.for('nodejs.util.inspect.custom')\n\nconst cacheKeySeparator = '\u2502'\n\n// this is always the same, but we don't hard code it as a string,\n// in case the DepID module needs to change its delimiter again ever.\nconst mainDepID = joinDepIDTuple(['file', '.'])\n\nexport type ManifestInventory = Map<DepID, NormalizedManifest>\n\nconst getMap = <T extends Map<any, any>>(m?: T) =>\n m ?? (new Map() as T)\n\n/**\n * Get a cache key for a resolution based on the\n * spec, location and query modifier.\n */\nconst getResolutionCacheKey = (\n spec: Spec,\n location: string,\n extra: string,\n): string => {\n const f = spec.final\n // if it's a file: dep, then the fromNode location matters\n const fromPrefix = f.type === 'file' ? location + ' : ' : ''\n // the unique key should also precise what is the type of the spec,\n // and in the case of a registry, what registry it is from.\n const typePrecisionKey =\n f.registry ?\n `${cacheKeySeparator}registry` +\n `${cacheKeySeparator}${f.registry}`\n : f.gitRemote ?\n `${cacheKeySeparator}git` + `${cacheKeySeparator}${f.gitRemote}`\n : `${cacheKeySeparator}${f.type}`\n const modifierSuffix = `${cacheKeySeparator}${extra}`\n return fromPrefix + String(f) + typePrecisionKey + modifierSuffix\n}\n\nexport type GraphOptions = SpecOptions & {\n /**\n * The main importer manifest info.\n */\n mainManifest: NormalizedManifest\n /**\n * An inventory of seen manifests.\n */\n manifests?: ManifestInventory\n /**\n * A {@link Monorepo} object, for managing workspaces\n */\n monorepo?: Monorepo\n /**\n * Root of the project this graph represents\n */\n projectRoot: string\n}\n\nexport class Graph implements GraphLike {\n get [Symbol.toStringTag]() {\n return '@vltpkg/graph.Graph'\n }\n\n #options: GraphOptions\n\n #nodeOptions: NodeOptions\n\n /**\n * A {@link Monorepo} instance, used for managing workspaces.\n */\n monorepo?: Monorepo\n\n /**\n * An inventory with all manifests related to an install.\n */\n manifests: ManifestInventory\n\n /**\n * A set of all edges in this graph.\n */\n edges = new Set<Edge>()\n\n /**\n * Map registered dep ids to the node that represent them in the graph.\n */\n nodes = new Map<DepID, Node>()\n\n /**\n * Map of nodes by their name\n */\n nodesByName = new Map<string, Set<Node>>()\n\n /**\n * Cached resolutions for spec lookups\n */\n resolutions = new Map<string, Node>()\n\n /**\n * Reverse map of resolutions\n */\n resolutionsReverse = new Map<Node, Set<string>>()\n\n /**\n * A set of importer nodes in this graph.\n */\n importers = new Set<Node>()\n\n /**\n * The {@link Node} that represents the project root `package.json`.\n */\n mainImporter: Node\n\n /**\n * A set of extraneous dependencies found when building the graph.\n */\n extraneousDependencies = new Set<Edge>()\n\n /**\n * The root of the project this graph represents\n */\n projectRoot: string\n\n /**\n * The peer context sets used to resolve peer dependencies within this graph.\n */\n peerContexts: PeerContext[]\n\n /**\n * Tracks the current peer context index.\n */\n currentPeerContextIndex = 0\n\n constructor(options: GraphOptions) {\n const { mainManifest, monorepo } = options\n this.#options = options\n // hydrate spec options to their full contents, including defaults\n const specOptions = getOptions({\n registry: options.registry,\n registries: options.registries,\n 'git-hosts': options['git-hosts'],\n 'git-host-archives': options['git-host-archives'],\n 'scope-registries': options['scope-registries'],\n 'jsr-registries': options['jsr-registries'],\n catalog: options.catalog,\n catalogs: options.catalogs,\n })\n this.manifests = getMap(options.manifests)\n this.projectRoot = options.projectRoot\n this.#nodeOptions = {\n ...this.#options,\n ...specOptions,\n graph: this,\n }\n\n // add the project root node\n const mainImporterLocation = '.'\n const mainImporterSpec = Spec.parse(\n mainManifest.name || '(root)',\n mainImporterLocation,\n )\n const mainImporter = this.addNode(\n mainDepID,\n mainManifest,\n mainImporterSpec,\n )\n mainImporter.setImporterLocation(mainImporterLocation)\n mainImporter.mainImporter = true\n this.mainImporter = mainImporter\n this.mainImporter.workspaces = new Map()\n this.importers.add(mainImporter)\n this.manifests.set(mainImporter.id, mainManifest)\n\n // uses the monorepo instance in order to retrieve info on\n // workspaces and create importer nodes for each of them\n this.monorepo = monorepo\n if (this.monorepo) {\n for (const ws of this.monorepo) {\n const wsNode = this.addNode(\n ws.id,\n ws.manifest,\n undefined,\n ws.name,\n )\n wsNode.setImporterLocation(`./${ws.path}`)\n if (wsNode.manifest) {\n this.manifests.set(wsNode.id, wsNode.manifest)\n }\n this.importers.add(wsNode)\n // creates a virtual edge to connect the workspaces to the root node\n const edge = new Edge(\n 'prod',\n Spec.parse(wsNode.name, 'workspace:*', this.#options),\n this.mainImporter,\n wsNode,\n )\n this.mainImporter.workspaces.set(wsNode.name, edge)\n }\n }\n\n // initializes the peer context set collection\n const initialPeerContext: PeerContext = new Map()\n initialPeerContext.index = this.currentPeerContextIndex\n this.peerContexts = [initialPeerContext]\n }\n\n /**\n * Get the next peer context index.\n */\n nextPeerContextIndex() {\n return ++this.currentPeerContextIndex\n }\n\n /**\n * Delete all nodes and edges that are unreachable from the importers.\n * The collection of deleted nodes is returned.\n *\n * NOTE: This can be extremely slow for large graphs, and is almost always\n * unnecessary! Only call when it is known that some unreachable nodes may\n * have been created, for example when deleting the unneeded subgraph when an\n * optional node fails to resolve/install.\n */\n gc() {\n const { nodes } = this\n this.edges.clear()\n this.nodes = new Map()\n const marked = new Set(this.importers)\n for (const imp of marked) {\n // don't delete the importer!\n nodes.delete(imp.id)\n this.nodes.set(imp.id, imp)\n for (const edge of imp.edgesOut.values()) {\n this.edges.add(edge)\n const { to } = edge\n if (!to || marked.has(to)) continue\n marked.add(to)\n nodes.delete(to.id)\n this.nodes.set(to.id, to)\n }\n }\n for (const node of nodes.values()) {\n this.removeNode(node)\n }\n return nodes\n }\n\n /**\n * Create a new edge between two nodes of the graph in case both exist,\n * in case the destination node does not exists, then a dangling edge,\n * pointing to nothing will be created to represent that missing dependency.\n */\n addEdge(\n type: DependencySaveType,\n spec: Spec,\n from: NodeLike,\n to?: NodeLike,\n ) {\n // fix any nameless spec\n if (spec.name === '(unknown)') {\n if (to) {\n spec.name = to.name /* c8 ignore next */ || '(unknown)'\n spec.spec = `${to.name}@${spec.bareSpec}`\n } else {\n throw error(\n 'Impossible to place a missing, nameless dependency',\n { spec },\n )\n }\n }\n const existing = from.edgesOut.get(spec.name)\n if (existing) {\n const edge = existing as Edge\n if (\n edge.type === type &&\n edge.spec.bareSpec === spec.bareSpec\n ) {\n if (to && to !== edge.to) {\n // removes this edge from its destination edgesIn ref\n edge.to?.edgesIn.delete(edge)\n // now swap the destination to the new one\n edge.to = to as Node\n edge.to.edgesIn.add(edge)\n }\n return edge\n }\n this.edges.delete(edge)\n }\n const f = from as Node\n const edgeOut = f.addEdgesTo(\n resolveSaveType(from, spec.name, type),\n spec,\n to as Node | undefined,\n )\n this.edges.add(edgeOut)\n return edgeOut\n }\n\n /**\n * Find an existing node to satisfy a dependency\n */\n findResolution(spec: Spec, fromNode: Node, extra = '') {\n const f = spec.final\n const sf = getResolutionCacheKey(f, fromNode.location, extra)\n const cached = this.resolutions.get(sf)\n if (cached) return cached\n const nbn = this.nodesByName.get(f.name)\n if (!nbn) return undefined\n for (const node of nbn) {\n if (\n satisfies(\n node.id,\n f,\n fromNode.location,\n this.projectRoot,\n this.monorepo,\n )\n ) {\n this.resolutions.set(sf, node)\n // always set by now, because the node was added at some point\n this.resolutionsReverse.get(node)?.add(sf)\n return node\n }\n }\n }\n\n /**\n * Create a new node in the graph.\n */\n addNode(\n id?: DepID,\n manifest?: NormalizedManifest,\n spec?: Spec,\n name?: string,\n version?: string,\n ) {\n const node = new Node(\n this.#nodeOptions,\n id,\n manifest,\n spec,\n name,\n version,\n )\n this.nodes.set(node.id, node)\n const nbn = this.nodesByName.get(node.name) ?? new Set()\n nbn.add(node)\n\n // ensure the nodes by name set is always sorted, this will help\n // keeping a deterministic graph resolution when reusing nodes\n const newByNameSet = new Set(\n [...nbn].sort((a, b) => a.id.localeCompare(b.id)),\n )\n this.nodesByName.set(node.name, newByNameSet)\n\n if (manifest) {\n this.manifests.set(node.id, manifest)\n }\n return node\n }\n\n /**\n * Place a new package into the graph representation, creating the new\n * edges and possibly new nodes that are to be expected when traversing\n * the graph in a top-down direction, e.g: from importers to leafs.\n *\n * For different uses that are not a direct top-down traversal of the graph\n * consider using `addNode()` and `addEdge()` instead.\n */\n placePackage(\n fromNode: Node,\n depType: DependencySaveType,\n spec: Spec,\n manifest?: NormalizedManifest,\n id?: DepID,\n extra?: string,\n ): Node | undefined {\n // if no manifest is available, then create an edge that has no\n // reference to any other node, representing a missing dependency\n if (!manifest && !id) {\n this.addEdge(depType, spec, fromNode)\n return\n }\n\n // flags set on the node we're about to create or find.\n const flags = {\n dev: fromNode.dev || depType === 'dev',\n optional:\n fromNode.optional ||\n depType === 'optional' ||\n depType === 'peerOptional',\n }\n\n const depId = id || (manifest && getId(spec, manifest, extra))\n\n /* c8 ignore start - should not be possible */\n if (!depId) {\n throw error('Could not find dep id when placing package', {\n spec,\n manifest,\n })\n }\n /* c8 ignore stop */\n\n // if a node for this package is already represented by a node\n // in the graph, then just creates a new edge to that node\n const toFoundNode = this.nodes.get(depId)\n if (toFoundNode) {\n this.addEdge(depType, spec, fromNode, toFoundNode)\n // the current only stays dev/optional if this dep lets it remain so\n // if it's not already, we don't make it dev or optional.\n toFoundNode.detached = false\n toFoundNode.dev &&= flags.dev\n toFoundNode.optional &&= flags.optional\n return toFoundNode\n }\n\n // creates a new node and edges to its parent\n const toNode = this.addNode(depId, manifest, spec)\n toNode.registry = spec.registry\n toNode.dev = flags.dev\n toNode.optional = flags.optional\n // split extra into modifier and peerSetHash\n if (extra) {\n const { modifier, peerSetHash } = splitExtra(extra)\n toNode.modifier = modifier\n toNode.peerSetHash = peerSetHash\n }\n\n // add extra manifest info if available\n if (manifest) {\n const { bin, engines, os, cpu } = manifest\n // add platform info if available\n if (engines || os || cpu) {\n const platform: NodeLike['platform'] = {}\n if (engines) platform.engines = engines\n if (os) platform.os = os\n if (cpu) platform.cpu = cpu\n toNode.platform = platform\n }\n // add bin info if available\n if (bin) {\n toNode.bins = bin\n }\n }\n toNode.maybeSetConfusedManifest(spec, manifest)\n\n this.addEdge(depType, spec, fromNode, toNode)\n\n // populate resolution cache if applicable\n const f = getResolutionCacheKey(\n spec.final,\n fromNode.location,\n extra || '',\n )\n this.resolutions.set(f, toNode)\n const rrev = this.resolutionsReverse.get(toNode) ?? new Set()\n rrev.add(f)\n this.resolutionsReverse.set(toNode, rrev)\n\n return toNode\n }\n\n /**\n * Removes a node and its relevant edges from the graph.\n *\n * Use the `keepEdges` option to keep the edges that were pointing to\n * this node and only removes their `to` property value.\n *\n * If a replacement is provided, then any edges that were previously\n * pointing to the removed node will be directed to the replacement,\n * if it is valid to do so.\n */\n removeNode(node: Node, replacement?: Node, keepEdges?: boolean) {\n this.nodes.delete(node.id)\n const nbn = this.nodesByName.get(node.name)\n // if it's the last one, just remove the set\n if (nbn?.size === 1) this.nodesByName.delete(node.name)\n else nbn?.delete(node)\n for (const r of this.resolutionsReverse.get(node) ?? new Set()) {\n this.resolutions.delete(r)\n }\n this.resolutionsReverse.delete(node)\n this.manifests.delete(node.id)\n for (const edge of node.edgesOut.values()) {\n this.edges.delete(edge)\n }\n for (const edge of node.edgesIn) {\n if (\n replacement &&\n satisfies(\n replacement.id,\n edge.spec,\n edge.from.location,\n this.projectRoot,\n this.monorepo,\n )\n ) {\n edge.to = replacement\n } else if (keepEdges) {\n edge.to = undefined\n } else {\n edge.from.edgesOut.delete(edge.spec.name)\n this.edges.delete(edge)\n }\n }\n }\n\n /**\n * Removes the resolved node of a given edge.\n */\n removeEdgeResolution(edge: Edge, extra = '') {\n const node = edge.to\n const resolutionKey = getResolutionCacheKey(\n edge.spec,\n edge.from.location,\n extra,\n )\n if (node) {\n edge.to = undefined\n this.resolutions.delete(resolutionKey)\n this.resolutionsReverse.get(node)?.delete(resolutionKey)\n this.nodesByName.delete(node.name)\n node.edgesIn.delete(edge)\n if (node.edgesIn.size === 0) {\n this.nodes.delete(node.id)\n }\n }\n }\n\n /**\n * Remove all edges from the graph while preserving nodes and resolution caches.\n * This allows the graph to be reconstructed efficiently using the existing nodes.\n */\n resetEdges() {\n // Clear the global edges set\n this.edges.clear()\n\n // Clear all node edge relationships\n for (const node of this.nodes.values()) {\n // marking nodes as detached needs to be restricted to only those\n // that had a manifest, otherwise we'd be skipping fetching manifest\n // for nodes we don't have a manifest during the ideal build phase\n if (node.manifest) node.detached = true\n\n // detaches all edges from this node\n node.edgesOut.clear()\n node.edgesIn.clear()\n }\n }\n\n toJSON() {\n return lockfileData({\n ...this.#options,\n graph: this,\n saveManifests: true,\n })\n }\n\n [kCustomInspect](_: number, options: InspectOptions) {\n const data = this.toJSON()\n return `${this[Symbol.toStringTag]} ${inspect(data, options)}`\n }\n}\n", "import {\n expandNormalizedManifestSymbols,\n isRecordStringString,\n} from '@vltpkg/types'\nimport {\n defaultGitHostArchives,\n defaultGitHosts,\n defaultJsrRegistries,\n defaultRegistries,\n defaultRegistry,\n defaultScopeRegistries,\n} from '@vltpkg/spec'\nimport { mkdirSync, writeFileSync } from 'node:fs'\nimport { dirname, resolve } from 'node:path'\nimport { getFlagNumFromNode, getBuildStateFromNode } from './types.ts'\nimport type { DepID } from '@vltpkg/dep-id'\nimport type { SpecOptions } from '@vltpkg/spec'\nimport type { Edge } from '../edge.ts'\nimport type { Graph } from '../graph.ts'\nimport type { Node } from '../node.ts'\nimport type {\n LockfileData,\n LockfileEdgeKey,\n LockfileEdges,\n LockfileEdgeValue,\n LockfileNode,\n LockfilePlatform,\n} from './types.ts'\nimport type { GraphModifier } from '../modifiers.ts'\nimport { error } from '@vltpkg/error-cause'\n\nexport type SaveOptions = SpecOptions & {\n /**\n * The graph to be stored in the lockfile.\n */\n graph: Graph\n /**\n * The graph modifiers helper object.\n */\n modifiers?: GraphModifier\n /**\n * Should it save manifest data in the lockfile?\n */\n saveManifests?: boolean\n /**\n * Should it save build state data in the lockfile?\n */\n saveBuildData?: boolean\n /**\n * Should it throw an error if a manifest is missing?\n */\n throwOnMissingManifest?: boolean\n}\n\nconst formatNodes = (\n nodes: Iterable<Node>,\n saveManifests?: boolean,\n saveBuildData?: boolean,\n registry?: string,\n throwOnMissingManifest?: boolean,\n) => {\n // we do not store importers in the lockfile, though we do store\n // their edges. when we load, we always read workspaces/main fresh.\n const arr: Node[] = [...nodes].filter(node => !node.importer)\n // nodes are sorted in order to have a deterministic result\n const orderedNodes: Node[] = arr.sort((a, b) =>\n a.id.localeCompare(b.id, 'en'),\n )\n\n const res: Record<DepID, LockfileNode> = {}\n for (const node of orderedNodes) {\n const customRegistry =\n node.resolved && registry && !node.resolved.startsWith(registry)\n const resolved = customRegistry ? node.resolved : undefined\n // if it's in a location other than the default, stash that\n const location =\n node.id.startsWith('file') || node.inVltStore() ?\n undefined\n : node.location\n\n const flags = getFlagNumFromNode(node)\n const lockfileNode: LockfileNode = [flags, node.name]\n\n if (node.integrity) {\n lockfileNode[2] = node.integrity\n }\n\n // skip resolved for remote nodes since\n // these are already part of the dep id\n if (resolved && !node.id.startsWith('remote')) {\n lockfileNode[3] = resolved\n }\n\n if (location) {\n lockfileNode[4] = location\n }\n\n if (saveManifests && node.manifest) {\n lockfileNode[5] = expandNormalizedManifestSymbols(node.manifest)\n\n if (node.confused && node.rawManifest) {\n lockfileNode[6] = expandNormalizedManifestSymbols(\n node.rawManifest,\n )\n }\n }\n\n // Throw an error if a manifest is missing and the option is enabled\n if (throwOnMissingManifest && !node.manifest) {\n throw error(`Missing manifest for node ${node.id}.`)\n }\n\n // Always save platform data for optional dependencies if available\n if (node.optional && node.platform) {\n lockfileNode[7] = node.platform as LockfilePlatform\n }\n\n // Save bin data if available\n if (node.bins && Object.keys(node.bins).length) {\n lockfileNode[8] = node.bins\n }\n\n // Save build state data if requested\n if (saveBuildData) {\n const buildState = getBuildStateFromNode(node)\n if (buildState !== undefined) {\n lockfileNode[9] = buildState\n }\n }\n\n res[node.id] = lockfileNode\n }\n return res\n}\n\nconst formatEdges = (edges: Set<Edge>): LockfileEdges =>\n Object.fromEntries(\n [...edges]\n .sort(\n (a, b) =>\n /* c8 ignore start - nondeterminstic and annoying to test */\n // sort importers to the top, then alphabetically by\n // id, type, target\n Number(b.from.importer) - Number(a.from.importer) ||\n a.from.id.localeCompare(b.from.id, 'en') ||\n a.type.localeCompare(b.type, 'en') ||\n (a.to?.id ?? '').localeCompare(b.to?.id ?? ''),\n /* c8 ignore stop */\n )\n .map((edge): [LockfileEdgeKey, LockfileEdgeValue] => [\n `${edge.from.id} ${edge.spec.name}`,\n `${edge.type} ${edge.spec.bareSpec || '*'} ${edge.to?.id ?? 'MISSING'}`,\n ]),\n )\n\nconst removeDefaultItems = (\n defaultItems: Record<string, string>,\n items: Record<string, string>,\n) => {\n const res: Record<string, string> = {}\n for (const [key, value] of Object.entries(items)) {\n if (!defaultItems[key] || defaultItems[key] !== value) {\n res[key] = value\n }\n }\n return res\n}\n\nexport const lockfileData = ({\n graph,\n catalog,\n catalogs,\n 'git-hosts': gitHosts,\n 'git-host-archives': gitHostArchives,\n modifiers,\n registry,\n registries,\n saveManifests,\n saveBuildData,\n 'scope-registries': scopeRegistries,\n 'jsr-registries': jsrRegistries,\n throwOnMissingManifest,\n}: SaveOptions): LockfileData => {\n const cleanGitHosts =\n isRecordStringString(gitHosts) ?\n removeDefaultItems(defaultGitHosts, gitHosts)\n : undefined\n const cleanGitHostArchives =\n isRecordStringString(gitHostArchives) ?\n removeDefaultItems(defaultGitHostArchives, gitHostArchives)\n : undefined\n const cleanModifiers =\n modifiers && isRecordStringString(modifiers.config) ?\n modifiers.config\n : undefined\n const cleanRegistries =\n isRecordStringString(registries) ?\n removeDefaultItems(defaultRegistries, registries)\n : undefined\n const cleanScopeRegistries =\n isRecordStringString(scopeRegistries) ?\n removeDefaultItems(defaultScopeRegistries, scopeRegistries)\n : undefined\n const cleanJsrRegistries =\n isRecordStringString(jsrRegistries) ?\n removeDefaultItems(defaultJsrRegistries, jsrRegistries)\n : undefined\n const hasItems = (clean: Record<string, unknown> | undefined) =>\n clean && Object.keys(clean).length\n return {\n lockfileVersion: 0,\n options: {\n ...(hasItems(cleanModifiers) ?\n { modifiers: cleanModifiers }\n : {}),\n ...(hasItems(catalog) ? { catalog } : {}),\n ...(hasItems(catalogs) ? { catalogs } : {}),\n ...(hasItems(cleanScopeRegistries) ?\n { 'scope-registries': cleanScopeRegistries }\n : undefined),\n ...(hasItems(cleanJsrRegistries) ?\n { 'jsr-registries': cleanJsrRegistries }\n : undefined),\n ...(registry !== undefined && registry !== defaultRegistry ?\n { registry }\n : undefined),\n ...(hasItems(registries) ?\n { registries: cleanRegistries }\n : undefined),\n ...(hasItems(cleanGitHosts) ?\n { 'git-hosts': cleanGitHosts }\n : undefined),\n ...(hasItems(cleanGitHostArchives) ?\n { 'git-host-archives': cleanGitHostArchives }\n : undefined),\n },\n nodes: formatNodes(\n graph.nodes.values(),\n saveManifests,\n saveBuildData,\n registry,\n throwOnMissingManifest,\n ),\n edges: formatEdges(graph.edges),\n }\n}\n\n// renders each node / edge as a single line entry\nconst extraFormat = (jsonString: string) => {\n const str = `${jsonString}\\n`\n const [init, ...parts] = str.split(' \"nodes\": {')\n const res = [init]\n for (const part of parts) {\n res.push(\n part.replaceAll('\\n ', '').replaceAll('\\n ]', ']'),\n )\n }\n return res.join(' \"nodes\": {')\n}\n\nexport const saveData = (\n data: LockfileData,\n fileName: string,\n saveManifests = false,\n): void => {\n const json = JSON.stringify(data, null, 2)\n const content = saveManifests ? json : extraFormat(json)\n writeFileSync(fileName, content)\n}\n\nexport const save = (\n options: Omit<SaveOptions, 'saveManifests'>,\n): void => {\n const { graph } = options\n const data = lockfileData({ ...options, saveManifests: false })\n const fileName = resolve(graph.projectRoot, 'vlt-lock.json')\n saveData(data, fileName, false)\n}\n\nexport const saveHidden = (\n options: Omit<SaveOptions, 'saveManifests' | 'saveBuildData'>,\n): void => {\n const { graph } = options\n let data: LockfileData | undefined\n\n try {\n data = lockfileData({\n ...options,\n saveManifests: true,\n saveBuildData: true,\n throwOnMissingManifest: true,\n })\n } catch {}\n\n if (!data) return\n\n const fileName = resolve(\n graph.projectRoot,\n 'node_modules/.vlt-lock.json',\n )\n mkdirSync(dirname(fileName), { recursive: true })\n saveData(data, fileName, true)\n}\n", "import type { DepID } from '@vltpkg/dep-id'\nimport type { Spec, SpecOptions } from '@vltpkg/spec'\nimport type {\n Integrity,\n NormalizedManifest,\n DependencyTypeShort,\n} from '@vltpkg/types'\nimport type { Graph } from '../graph.ts'\n\n/**\n * Platform requirements for a lockfile node\n */\nexport type LockfilePlatform = {\n engines?: Record<string, string>\n os?: string[] | string\n cpu?: string[] | string\n}\n\n/**\n * This is the main type definition for the contents of the\n * `vlt-lock.json` file.\n *\n * The nodes and edges information from the lockfile are used to reconstruct\n * a {@link Graph} representing a previous install.\n */\nexport type LockfileData = {\n lockfileVersion: number\n options: SpecOptions & {\n modifiers?: Record<string, string> | undefined\n }\n nodes: Record<DepID, LockfileNode>\n edges: LockfileEdges\n}\n\nexport const getFlagNumFromNode = (node: {\n optional?: boolean\n dev?: boolean\n}) =>\n node.optional && node.dev ? LockfileNodeFlagDevOptional\n : node.optional ? LockfileNodeFlagOptional\n : node.dev ? LockfileNodeFlagDev\n : LockfileNodeFlagNone\n\nexport const getBooleanFlagsFromNum = (flags: LockfileNodeFlags) => ({\n dev: !!(flags & LockfileNodeFlagDev),\n optional: !!(flags & LockfileNodeFlagOptional),\n})\n\nexport const LockfileNodeFlagNone = 0\nexport const LockfileNodeFlagOptional = 1\nexport const LockfileNodeFlagDev = 2\nexport const LockfileNodeFlagDevOptional = 3\n\n/**\n * Bit flags indicating whether a node is optional and/or dev.\n */\nexport type LockfileNodeFlags = 0 | 1 | 2 | 3\n\n/**\n * Build state constants for lockfile nodes\n */\nexport const BuildStateNone = undefined\nexport const BuildStateNeeded = 1\nexport const BuildStateBuilt = 2\nexport const BuildStateFailed = 3\n\n/**\n * Build state for a node - tracks whether it needs building, has been built, or failed\n */\nexport type LockfileBuildState = undefined | 1 | 2 | 3\n\nexport const getBuildStateFromNode = (node: {\n buildState?: 'none' | 'needed' | 'built' | 'failed'\n}): LockfileBuildState => {\n switch (node.buildState) {\n case 'needed':\n return BuildStateNeeded\n case 'built':\n return BuildStateBuilt\n case 'failed':\n return BuildStateFailed\n default:\n return BuildStateNone\n }\n}\n\nexport const getBuildStateFromNum = (\n state: LockfileBuildState,\n): 'none' | 'needed' | 'built' | 'failed' => {\n switch (state) {\n case BuildStateNeeded:\n return 'needed'\n case BuildStateBuilt:\n return 'built'\n case BuildStateFailed:\n return 'failed'\n default:\n return 'none'\n }\n}\n\n/**\n * Lockfile representation of a node from the install graph.\n */\nexport type LockfileNode = [\n flags: LockfileNodeFlags,\n name?: string | null,\n integrity?: Integrity | null,\n resolved?: string | null,\n location?: string | null,\n manifest?: NormalizedManifest | null,\n rawManifest?: NormalizedManifest | null,\n platform?: LockfilePlatform | null,\n bins?: Record<string, string> | null,\n buildState?: LockfileBuildState | null,\n]\n\n/**\n * Lockfile edges are stored as a record object where the key\n * is `${from.id} ${spec.name}` and the value is\n * `${type} ${spec.bareSpec} ${to.id | 'MISSING'}`\n *\n * Storing them in a record like this means that we are guaranteed to\n * never end up with duplicates, and a standard `JSON.stringify()`\n * will nicely print them out one line per edge.\n */\nexport type LockfileEdges = {\n [key: LockfileEdgeKey]: LockfileEdgeValue\n}\n\n/** `${from} ${dep name}` */\nexport type LockfileEdgeKey = `${DepID} ${string}`\n\n/** `${type} ${spec} ${to}` */\nexport type LockfileEdgeValue =\n `${DependencyTypeShort} ${Spec['bareSpec']} ${DepID | 'MISSING'}`\n", "import type {\n DependencySaveType,\n DependencyTypeShort,\n NodeLike,\n} from '@vltpkg/types'\n\n/**\n * Resolve a {@link DependencySaveType} to a {@link DependencyTypeShort}\n */\nexport const resolveSaveType = (\n node: NodeLike,\n name: string,\n saveType: DependencySaveType,\n): DependencyTypeShort =>\n saveType !== 'implicit' ? saveType : (\n (node.edgesOut.get(name)?.type ?? 'prod')\n )\n", "import { PackageJson } from '@vltpkg/package-json'\nimport { Monorepo } from '@vltpkg/workspaces'\nimport { readFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport { loadEdges } from './load-edges.ts'\nimport { loadNodes } from './load-nodes.ts'\nimport { Graph } from '../graph.ts'\nimport type { PathScurry } from 'path-scurry'\nimport type { NormalizedManifest } from '@vltpkg/types'\nimport type { SpecOptions } from '@vltpkg/spec'\nimport type { LockfileData } from './types.ts'\nimport type { GraphModifier } from '../modifiers.ts'\n\nexport type LoadOptions = SpecOptions & {\n /**\n * An optional {@link Graph} object to hydrate extra data from.\n */\n actual?: Graph\n /**\n * The project root dirname.\n */\n projectRoot: string\n /**\n * The project root manifest.\n */\n mainManifest: NormalizedManifest\n /**\n * The graph modifiers helper object.\n */\n modifiers?: GraphModifier\n /**\n * A {@link Monorepo} object, for managing workspaces\n */\n monorepo?: Monorepo\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 /**\n * Whether to throw an error if a manifest is missing when loading nodes.\n */\n throwOnMissingManifest?: boolean\n}\n\nconst loadLockfile = (projectRoot: string, lockfilePath: string) =>\n JSON.parse(\n readFileSync(resolve(projectRoot, lockfilePath), {\n encoding: 'utf8',\n }),\n ) as LockfileData\n\nexport const load = (options: LoadOptions): Graph => {\n const { projectRoot } = options\n return loadObject(\n options,\n loadLockfile(projectRoot, 'vlt-lock.json'),\n )\n}\n\nexport const loadHidden = (options: LoadOptions): Graph => {\n const { projectRoot } = options\n // Ensure that missing manifests throw an error when loading hidden lockfiles\n options.throwOnMissingManifest = true\n return loadObject(\n options,\n loadLockfile(projectRoot, 'node_modules/.vlt-lock.json'),\n )\n}\n\nexport const loadObject = (\n options: LoadOptions,\n lockfileData: Omit<LockfileData, 'options' | 'lockfileVersion'> &\n Partial<Pick<LockfileData, 'options' | 'lockfileVersion'>>,\n) => {\n const { mainManifest, scurry } = options\n const packageJson = options.packageJson ?? new PackageJson()\n const monorepo =\n options.monorepo ??\n Monorepo.maybeLoad(options.projectRoot, { packageJson, scurry })\n const {\n catalog = {},\n catalogs = {},\n 'scope-registries': scopeRegistries,\n registry,\n registries,\n 'git-hosts': gitHosts,\n 'git-host-archives': gitHostArchives,\n /* c8 ignore next */\n } = lockfileData.options ?? {}\n\n // Optimize options merging - only create new objects when needed\n const mergedOptions = {\n ...options,\n catalog,\n catalogs,\n 'scope-registries':\n scopeRegistries ?\n { ...options['scope-registries'], ...scopeRegistries }\n : options['scope-registries'],\n registry: registry ?? options.registry,\n registries:\n registries ?\n { ...options.registries, ...registries }\n : options.registries,\n 'git-hosts':\n gitHosts ?\n { ...options['git-hosts'], ...gitHosts }\n : options['git-hosts'],\n 'git-host-archives':\n gitHostArchives ?\n { ...options['git-host-archives'], ...gitHostArchives }\n : options['git-host-archives'],\n }\n const graph = new Graph({\n ...mergedOptions,\n mainManifest,\n monorepo,\n })\n loadNodes(\n graph,\n lockfileData.nodes,\n mergedOptions,\n options.actual,\n options.throwOnMissingManifest,\n )\n loadEdges(graph, lockfileData.edges, mergedOptions)\n\n // hydrate missing node-level registry data\n for (const node of graph.nodes.values()) {\n const [firstEdge] = node.edgesIn\n if (firstEdge?.spec.registry) {\n node.registry = firstEdge.spec.registry\n }\n }\n\n return graph\n}\n", "import { asDepID } from '@vltpkg/dep-id/browser'\nimport { error } from '@vltpkg/error-cause'\nimport { fastSplit } from '@vltpkg/fast-split'\nimport { Spec } from '@vltpkg/spec/browser'\nimport type { SpecOptions } from '@vltpkg/spec/browser'\nimport { longDependencyTypes } from '@vltpkg/types'\nimport type {\n DependencyTypeShort,\n GraphLike,\n NodeLike,\n} from '@vltpkg/types'\nimport { isDependencyTypeShort } from '../dependencies.ts'\nimport type {\n LockfileData,\n LockfileEdgeKey,\n LockfileEdgeValue,\n} from './types.ts'\n\nexport type ProcessingEdge = {\n fromNode: NodeLike\n toNode: NodeLike | undefined\n depType: DependencyTypeShort\n spec: Spec\n}\n\nconst retrieveNodeFromGraph = (\n key: string,\n value: string,\n graph: GraphLike,\n fromId: string,\n seenNodes?: Map<string, NodeLike>,\n): NodeLike => {\n const foundNode = graph.nodes.get(asDepID(fromId))\n if (!foundNode) {\n throw error('Edge info missing its `from` node', {\n found: {\n nodes: [...graph.nodes].map(([id]) => id),\n from: foundNode,\n fromId,\n edge: { [key]: value },\n },\n })\n }\n if (seenNodes) {\n seenNodes.set(fromId, foundNode)\n }\n return foundNode\n}\n\nexport const loadEdges = (\n graph: GraphLike,\n edges: LockfileData['edges'],\n options: SpecOptions,\n) => {\n const entries = Object.entries(edges) as [\n LockfileEdgeKey,\n LockfileEdgeValue,\n ][]\n\n const edgeCount = entries.length\n // Only use optimizations for non-trivial graphs\n const useOptimizations = edgeCount > 50\n const edgeProcessingQueue: ProcessingEdge[] = []\n\n // Cache for frequently accessed nodes to avoid repeated Map lookups\n const seenNodes =\n useOptimizations ? new Map<string, NodeLike>() : undefined\n\n for (const [key, value] of entries) {\n const [fromId, specName] = fastSplit(key, ' ', 2)\n const [depType, valRest] = fastSplit(value, ' ', 2)\n const vrSplit = valRest?.lastIndexOf(' ') ?? -1\n\n // not a valid edge record\n /* c8 ignore start */\n if (!valRest || !depType || !fromId || !specName || vrSplit < 1) {\n continue\n }\n /* c8 ignore stop */\n\n // Validate dependency type early\n if (!isDependencyTypeShort(depType)) {\n throw error('Found unsupported dependency type in lockfile', {\n validOptions: [...longDependencyTypes],\n })\n }\n\n // Use cached node lookup for large graphs, direct lookup for small ones\n let fromNode: NodeLike\n if (seenNodes) {\n const seen = seenNodes.get(fromId)\n if (seen) {\n fromNode = seen\n } else {\n fromNode = retrieveNodeFromGraph(\n key,\n value,\n graph,\n fromId,\n seenNodes,\n )\n }\n } else {\n fromNode = retrieveNodeFromGraph(key, value, graph, fromId)\n }\n\n const toId = valRest.substring(vrSplit + 1)\n let toNode: NodeLike | undefined = undefined\n\n if (toId !== 'MISSING') {\n if (seenNodes) {\n const seen = seenNodes.get(toId)\n if (seen) {\n toNode = seen\n } else {\n toNode = graph.nodes.get(asDepID(toId))\n if (toNode) {\n seenNodes.set(toId, toNode)\n }\n }\n } else {\n toNode = graph.nodes.get(asDepID(toId))\n }\n }\n\n // Parse spec once we know the nodes are valid\n const spec = Spec.parse(specName, valRest.substring(0, vrSplit), {\n ...options,\n registry: fromNode.registry,\n })\n\n if (useOptimizations) {\n edgeProcessingQueue.push({\n fromNode,\n toNode,\n depType,\n spec,\n })\n } else {\n // Process immediately for small graphs\n graph.addEdge(depType, spec, fromNode, toNode)\n }\n }\n\n // Batch process all edges (only for non-trivial graphs)\n if (useOptimizations) {\n for (const {\n fromNode,\n toNode,\n depType,\n spec,\n } of edgeProcessingQueue) {\n graph.addEdge(depType, spec, fromNode, toNode)\n }\n }\n}\n", "import { error } from '@vltpkg/error-cause'\nimport { splitDepID, splitExtra } from '@vltpkg/dep-id/browser'\nimport {\n getBooleanFlagsFromNum,\n getBuildStateFromNum,\n} from './types.ts'\nimport type { LockfileData, LockfileNode } from './types.ts'\nimport type { DepID } from '@vltpkg/dep-id'\nimport type { GraphLike } from '@vltpkg/types'\nimport type { SpecOptions } from '@vltpkg/spec/browser'\n\nexport const loadNodes = (\n graph: GraphLike,\n nodes: LockfileData['nodes'],\n options: SpecOptions,\n actual?: GraphLike,\n throwOnMissingManifest?: boolean,\n) => {\n const entries = Object.entries(nodes) as [DepID, LockfileNode][]\n const nodeCount = entries.length\n\n // Batch process registry spec parsing (only for large graphs)\n // Only used for non-trivial graphs\n const registryVersionCache =\n nodeCount > 50 ? new Map<string, string>() : null\n\n for (const [id, lockfileNode] of entries) {\n const [\n flags,\n name,\n integrity,\n resolved,\n location,\n manifest,\n rawManifest,\n platform,\n bins,\n buildState,\n ] = lockfileNode\n // workspace nodes and the project root node are already part of the\n // graph and it should not create new nodes if an existing one is there\n if (graph.nodes.has(id)) continue\n\n const [type, filepath, maybeExtra, lastExtra] = splitDepID(id)\n const extra =\n type === 'registry' || type === 'git' ? lastExtra : maybeExtra\n const registrySpec = maybeExtra\n\n // The reference node is a node that matches the same id from the\n // current iterating node in the provided `actual` graph, this allows\n // for hydrating missing manifest, integrity, and resolved values\n // that may be missing from the lockfile\n const referenceNode = actual?.nodes.get(id)\n const mani = manifest ?? referenceNode?.manifest\n\n // Throw if manifest is missing and the option is enabled\n if (!mani && throwOnMissingManifest) {\n throw error(\n `Missing manifest for node ${id} and no reference node found.`,\n )\n }\n\n // Optimize registry version extraction with caching for large graphs\n let version: string | undefined\n if (\n type === 'registry' &&\n registrySpec &&\n registrySpec.indexOf('@') > 0\n ) {\n if (registryVersionCache) {\n const seenVersion = registryVersionCache.get(registrySpec)\n /* c8 ignore start */\n if (seenVersion) {\n version = seenVersion\n } else {\n version = registrySpec.split('@').slice(-1)[0] || undefined\n /* c8 ignore stop */\n if (version) {\n registryVersionCache.set(registrySpec, version)\n }\n }\n } else {\n version = registrySpec.split('@').slice(-1)[0] || undefined\n }\n }\n\n // if the lockfile has manifest data then it should just use that\n // otherwise tries to infer name / version value from the lockfile node\n const node =\n mani ?\n graph.addNode(id, mani)\n : graph.addNode(\n id,\n undefined,\n undefined,\n name ?? undefined,\n version,\n )\n\n if (extra) {\n const { modifier, peerSetHash } = splitExtra(extra)\n if (modifier) {\n node.modifier = modifier\n }\n if (peerSetHash) {\n node.peerSetHash = peerSetHash\n }\n }\n\n const { dev, optional } = getBooleanFlagsFromNum(flags)\n node.options = options\n node.dev = dev\n node.optional = optional\n node.integrity = integrity ?? referenceNode?.integrity\n node.resolved =\n type === 'remote' ? filepath : (\n (resolved ?? referenceNode?.resolved)\n )\n node.projectRoot = graph.projectRoot\n if (!node.resolved) node.setResolved()\n if (location) {\n node.location = location\n } else {\n // set the location to file dependencies based on the id value\n if (type === 'file') {\n node.location = filepath\n }\n }\n if (mani && rawManifest) {\n node.setConfusedManifest(mani, rawManifest)\n }\n\n // Set platform data if provided\n if (platform) {\n node.platform = platform\n }\n\n // optionally set bin data if provided\n if (bins) {\n node.bins = bins\n }\n\n // Set build state if provided\n if (buildState !== undefined && buildState !== null) {\n node.buildState = getBuildStateFromNum(buildState)\n }\n }\n}\n", "import {\n asDepID,\n hydrate,\n joinDepIDTuple,\n joinExtra,\n splitDepID,\n splitExtra,\n} from '@vltpkg/dep-id'\nimport { Spec } from '@vltpkg/spec'\nimport { graphStep } from '@vltpkg/output'\nimport { isObject } from '@vltpkg/types'\nimport {\n shorten,\n getRawDependencies,\n getDependencies,\n} from '../dependencies.ts'\nimport { Graph } from '../graph.ts'\nimport { loadHidden } from '../lockfile/load.ts'\nimport { saveHidden } from '../lockfile/save.ts'\nimport type { DepID } from '@vltpkg/dep-id'\nimport type { PackageJson } from '@vltpkg/package-json'\nimport type { SpecOptions } from '@vltpkg/spec'\nimport type { NormalizedManifest } from '@vltpkg/types'\nimport type { Monorepo } from '@vltpkg/workspaces'\nimport type { Path, PathScurry } from 'path-scurry'\nimport type { Node } from '../node.ts'\nimport type {\n GraphModifier,\n ModifierActiveEntry,\n} from '../modifiers.ts'\nimport { readFileSync } from 'node:fs'\n\nexport type LoadOptions = SpecOptions & {\n /**\n * The project root dirname.\n */\n projectRoot: string\n /**\n * The project root manifest.\n */\n mainManifest?: NormalizedManifest\n /**\n * The graph modifiers helper object.\n */\n modifiers?: GraphModifier\n /**\n * A {@link Monorepo} object, for managing workspaces\n */\n monorepo?: Monorepo\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 /**\n * If set to `false`, `actual.load` will not load any `package.json`\n * files while traversing the file system.\n *\n * The resulting {@link Graph} from loading with `loadManifests=false`\n * has no information on dependency types or the specs defined and\n * no information on missing and extraneous dependencies.\n */\n loadManifests?: boolean\n /**\n * If set to `true`, then do not shortcut the process by reading the\n * hidden lockfile at `node_modules/.vlt-lock.json`\n */\n skipHiddenLockfile?: boolean\n /**\n * Load only importers into the graph if the modifiers have changed.\n */\n skipLoadingNodesOnModifiersChange?: boolean\n // TODO: move the lockfile-related options to a separate type file\n /**\n * If set to `true`, fail if lockfile is missing or out of date.\n * Used by ci command to enforce lockfile integrity.\n */\n expectLockfile?: boolean\n /**\n * If set to `true`, fail if lockfile is missing or out of sync with package.json.\n * Prevents any lockfile modifications and is stricter than expectLockfile.\n */\n frozenLockfile?: boolean\n /**\n * If set to `true`, only update the lockfile without performing any node_modules\n * operations. Skips package extraction, filesystem operations, and hidden lockfile saves.\n */\n lockfileOnly?: boolean\n}\n\nexport type ReadEntry = {\n alias: string\n name: string\n realpath: Path\n}\n\n/**\n * The configuration object type as it is saved in the `.vlt/vlt.json`\n */\nexport type StoreConfigObject = {\n modifiers: Record<string, string> | undefined\n}\n\n/**\n * Checks if a given object is a {@link StoreConfigObject}.\n */\nexport const isStoreConfigObject = (\n obj: unknown,\n): obj is StoreConfigObject =>\n isObject(obj) &&\n Object.prototype.hasOwnProperty.call(obj, 'modifiers') &&\n isObject(obj.modifiers)\n\n/**\n * Returns a {@link StoreConfigObject} from a given object.\n * Throws a TypeError if the object can't be converted.\n */\nexport const asStoreConfigObject = (\n obj: unknown,\n): StoreConfigObject => {\n if (!isStoreConfigObject(obj)) {\n throw new TypeError(`Expected a store config object, got ${obj}`)\n }\n return obj\n}\n\n// path-based refer to the types of dependencies that are directly linked to\n// their real location in the file system and thus will not have an entry\n// in the `node_modules/.vlt` store\nconst pathBasedType = new Set(['file', 'workspace'])\nconst isPathBasedType = (\n type: string,\n): type is 'file' | 'workspace' => pathBasedType.has(type)\n\n/**\n * Returns a {@link DepID} for a given spec and path, if the spec is\n * path-based or a registry spec, otherwise returns `undefined`.\n */\nexport const getPathBasedId = (\n spec: Spec,\n path: Path,\n): DepID | undefined =>\n isPathBasedType(spec.type) ?\n joinDepIDTuple([spec.type, path.relativePosix()])\n : findDepID(path)\n\n/**\n * Retrieve the {@link DepID} for a given package from its location.\n */\nconst findDepID = ({ parent, name }: Path): DepID | undefined =>\n parent?.name === '.vlt' ? asDepID(name)\n : parent?.isCWD === false ? findDepID(parent)\n : undefined\n\n/**\n * Retrieves the closest `node_modules` parent {@link Path} found.\n */\nconst findNodeModules = ({\n parent,\n name,\n isCWD,\n}: Path): Path | undefined =>\n parent?.name === 'node_modules' ? parent\n : parent && name !== '.vlt' && !isCWD ? findNodeModules(parent)\n : undefined\n\n/**\n * Retrieves the scoped-normalized package name from its {@link Path}.\n */\nconst findName = ({ parent, name }: Path): string =>\n parent?.name.startsWith('@') ? `${parent.name}/${name}` : name\n\n/**\n * Helper function that gets a modified {@link Spec} when finding a modifier\n * that applies to a given dependency. Otherwise returns the original spec\n * value and no queryModifier.\n */\nconst maybeApplyModifierToSpec = (\n spec: Spec,\n depName: string,\n modifierRefs?: Map<string, ModifierActiveEntry>,\n): { spec: Spec; queryModifier?: string } => {\n const activeModifier = modifierRefs?.get(depName)\n const queryModifier = activeModifier?.modifier.query\n const completeModifier =\n activeModifier &&\n activeModifier.interactiveBreadcrumb.current ===\n activeModifier.modifier.breadcrumb.last\n\n if (\n queryModifier &&\n completeModifier &&\n 'spec' in activeModifier.modifier\n ) {\n const modifiedSpec = activeModifier.modifier.spec\n modifiedSpec.overridden = true\n return { spec: modifiedSpec, queryModifier }\n }\n\n return { spec, queryModifier }\n}\n\n/**\n * Reads the current directory defined at `currDir` and looks for folder\n * names and their realpath resolution, normalizing scoped package names\n * and removing any invalid symlinks from the list of items that should\n * be parsed through in order to build the graph.\n */\nconst readDir = (\n scurry: PathScurry,\n currDir: Path,\n fromNodeName?: string,\n) => {\n const res = new Set<ReadEntry>()\n for (const entry of scurry.readdirSync(currDir)) {\n // ignore any hidden files / folders\n if (entry.name.startsWith('.')) continue\n\n // scope folder found, it will need to be read and iterated over\n // in order to find any scoped packages inside\n if (entry.name.startsWith('@')) {\n const scopedItems = readDir(scurry, entry, fromNodeName)\n for (const scopedItem of scopedItems) {\n res.add(scopedItem)\n }\n continue\n }\n\n // skip anything that isn't a symlink, it's not an edge\n if (!entry.isSymbolicLink()) continue\n\n // we'll need to learn what is the real path for this entry in order\n // to retrieve the `location` and `id` properties for the node, if a\n // realpath is not found just move on to the next element\n const realpath = entry.realpathSync()\n if (!realpath) {\n continue\n }\n\n // infer both the alias and proper package names, including scopes\n const alias = findName(entry)\n const name = findName(realpath)\n res.add({\n alias,\n name,\n realpath,\n })\n }\n return res\n}\n\n/**\n * Parses the files located at `currDir` and place packages found inside\n * as dependencies of `fromNode`, building the instantiated `graph`.\n */\nconst parseDir = (\n options: LoadOptions,\n scurry: PathScurry,\n packageJson: PackageJson,\n depsFound: Map<Node, Path>,\n graph: Graph,\n fromNode: Node,\n currDir: Path,\n) => {\n const { loadManifests, modifiers } = options\n const dependencies = getRawDependencies(fromNode)\n const seenDeps = new Set<string>()\n const readItems: Set<ReadEntry> = readDir(\n scurry,\n currDir,\n fromNode.name,\n )\n\n // Get modifier references for this node's dependencies\n const modifierRefs = modifiers?.tryDependencies(fromNode, [\n ...getDependencies(fromNode, options).values(),\n ])\n\n for (const { alias, name, realpath } of readItems) {\n let node\n\n // tracks what dependencies have been seen\n // so that we can mark missing dependencies\n seenDeps.add(alias)\n\n // places the package in the graph reading\n // its manifest only if necessary\n if (!loadManifests) {\n const depId = findDepID(realpath)\n\n if (depId) {\n let h = hydrate(depId, alias, options)\n // if the parsed registry value is using the default value, then\n // the node should inherit the registry value from its parent node\n if (\n h.type === 'registry' &&\n h.registry === h.options.registry &&\n fromNode.registry\n ) {\n h.registry = fromNode.registry\n }\n\n // Check for active modifiers and replace spec even when not loading manifests\n const { spec: modifiedSpec, queryModifier } =\n maybeApplyModifierToSpec(h, alias, modifierRefs)\n h = modifiedSpec\n\n // graphs build with no manifest have no notion of\n // dependency types and or spec definitions since those\n // would have to be parsed from a manifest\n node = graph.placePackage(\n fromNode,\n 'prod', // defaults to prod deps\n h, // uses spec from hydrated id\n {\n name,\n },\n depId,\n joinExtra({ modifier: queryModifier }),\n )\n\n // Update active entry after placing package\n const activeModifier = modifierRefs?.get(alias)\n if (activeModifier && node) {\n modifiers?.updateActiveEntry(node, activeModifier)\n }\n }\n }\n\n // retrieve references to the current folder name found in `fromNode`\n // manifest listed dependencies, removing it from the map will leave\n // a list of missing dependencies at the end of the iteration\n const deps = dependencies.get(alias)\n\n // in case this graph is skipping manifests, this next block might\n // still need to execute, thus actually loading a manifest file, for\n // edge-cases such as loading a linked node that is not going to have\n // DepID info available in its realpath or extraneous nodes\n if (!node) {\n const mani = packageJson.read(realpath.fullpath())\n // declares fallback default values for both depType and bareSpec\n // in order to support loadManifests=false fallback for link nodes\n const type = deps?.type || 'dependencies'\n const bareSpec = deps?.bareSpec || '*'\n\n const depType = shorten(type, alias, fromNode.manifest)\n let spec = Spec.parse(alias, bareSpec, {\n ...options,\n registry: fromNode.registry,\n })\n\n // Check for active modifiers and replace spec if a modifier is complete\n const { spec: modifiedSpec, queryModifier } =\n maybeApplyModifierToSpec(spec, alias, modifierRefs)\n spec = modifiedSpec\n\n const maybeId = getPathBasedId(spec, realpath)\n let peerSetHash: string | undefined\n if (maybeId) {\n // parses extra info from depID to retrieve peerSetHash\n try {\n const tuple = splitDepID(maybeId)\n const type = tuple[0]\n const extra =\n type === 'registry' || type === 'git' ?\n tuple[3]\n : tuple[2]\n\n peerSetHash =\n extra ? splitExtra(extra).peerSetHash : undefined\n /* c8 ignore next - impossible: getPathBasedId asserts valid dep id */\n } catch {}\n }\n node = graph.placePackage(\n fromNode,\n depType,\n spec,\n mani,\n maybeId,\n joinExtra({ modifier: queryModifier, peerSetHash }),\n )\n\n // Update active entry after placing package\n const activeModifier = modifierRefs?.get(alias)\n if (activeModifier && node) {\n modifiers?.updateActiveEntry(node, activeModifier)\n }\n }\n\n if (node) {\n // If a found dependency is not declared in any of the original\n // node dependencies, then add an edge to the graph pointing to it\n // and mark it as extraneous.\n //\n // This only makes sense if full manifests are being loaded\n // so that we have reference to dependencies info.\n if (loadManifests && !deps) {\n const [edge] = node.edgesIn\n if (edge) {\n graph.extraneousDependencies.add(edge)\n }\n }\n\n // for a succesfully created node, add its location\n // property and queue up to read its dependencies\n node.location = `./${realpath.relativePosix()}`\n const node_modules = findNodeModules(realpath)\n\n // queue items up to continue parsing dirs in case a node was succesfully\n // placed in the graph and its node_modules folder was correctly found\n if (node_modules) {\n depsFound.set(node, node_modules)\n }\n }\n }\n\n // any remaining dependencies that have not been found\n // when reading the directory should be marked as missing\n for (const { name, type, bareSpec } of dependencies.values()) {\n if (!seenDeps.has(name)) {\n const depType = shorten(type, name, fromNode.manifest)\n let spec = Spec.parse(name, bareSpec, {\n ...options,\n registry: fromNode.registry,\n })\n\n // Check for active modifiers and replace spec for missing dependencies\n const { spec: modifiedSpec, queryModifier } =\n maybeApplyModifierToSpec(spec, name, modifierRefs)\n spec = modifiedSpec\n\n graph.placePackage(\n fromNode,\n depType,\n spec,\n undefined,\n undefined,\n joinExtra({ modifier: queryModifier }),\n )\n }\n }\n}\n\n/**\n * Read the file system looking for `node_modules` folders and\n * returns a new {@link Graph} that represents the relationship\n * between the dependencies found.\n */\nexport const load = (options: LoadOptions): Graph => {\n const done = graphStep('actual')\n const {\n modifiers,\n monorepo,\n projectRoot,\n packageJson,\n scurry,\n skipHiddenLockfile = false,\n skipLoadingNodesOnModifiersChange = false,\n } = options\n const mainManifest =\n options.mainManifest ?? packageJson.read(projectRoot)\n\n if (!skipHiddenLockfile) {\n try {\n // if we reach here, the hidden lockfile is valid\n const graph = loadHidden({\n ...options,\n projectRoot,\n mainManifest,\n packageJson,\n monorepo,\n scurry,\n })\n done()\n return graph\n } catch {\n // if validation fails or any other error occurs,\n // fall back to filesystem traversal\n }\n }\n\n const graph = new Graph({ ...options, mainManifest })\n\n // retrieve the configuration object from the store\n let storeConfig: StoreConfigObject = { modifiers: undefined }\n try {\n storeConfig = asStoreConfigObject(\n JSON.parse(\n readFileSync(\n scurry.resolve('node_modules/.vlt/vlt.json'),\n 'utf8',\n ),\n ),\n )\n } catch {}\n const storeModifiers = JSON.stringify(storeConfig.modifiers ?? {})\n const optionsModifiers = JSON.stringify(modifiers?.config)\n const modifiersChanged = storeModifiers !== optionsModifiers\n const shouldLoadDependencies = !(\n skipLoadingNodesOnModifiersChange && modifiersChanged\n )\n\n // will only skip loading dependencies if the\n // skipLoadingNodesOnModifiersChange option is set to true\n // and the current modifiers have not changed when compared\n // to the modifiers stored in the `node_modules/.vlt/vlt.json` store config\n if (shouldLoadDependencies) {\n const depsFound = new Map<Node, Path>()\n\n // starts the list of initial folders to parse using the importer nodes\n for (const importer of graph.importers) {\n modifiers?.tryImporter(importer)\n depsFound.set(\n importer,\n scurry.cwd.resolve(`${importer.location}/node_modules`),\n )\n }\n\n // breadth-first traversal of the file system tree reading deps found\n // starting from the node_modules folder of every importer in order to\n // find the actual installed dependencies at each location\n for (const [node, path] of depsFound.entries()) {\n parseDir(\n options,\n scurry,\n packageJson,\n depsFound,\n graph,\n node,\n path,\n )\n }\n\n // Clean up any pending modifier entries that were never completed\n modifiers?.rollbackActiveEntries()\n\n // caches the load result to the hidden lockfile when enabled\n if (\n scurry.cwd.resolve('node_modules').lstatSync()?.isDirectory()\n ) {\n saveHidden({\n ...options,\n graph,\n })\n }\n }\n\n done()\n\n return graph\n}\n", "// walk the graph of added nodes, building and chmoding their bins\n// at the end, we get back to the importers, and run their prepare\n// script as well as install script.\n\nimport { join } from 'node:path'\nimport type { PackageJson } from '@vltpkg/package-json'\nimport { run } from '@vltpkg/run'\nimport { graphRun } from '@vltpkg/graph-run'\nimport type { PathScurry } from 'path-scurry'\nimport type { DepID } from '@vltpkg/dep-id'\nimport type { Diff } from '../diff.ts'\nimport type { Node } from '../node.ts'\nimport { nonEmptyList } from '../non-empty-list.ts'\nimport { optionalFail } from './optional-fail.ts'\nimport { binChmod } from './bin-chmod.ts'\n\n/**\n * Returns an object mapping registries to the names of the packages built.\n */\nexport type BuildResult = {\n success: Node[]\n failure: Node[]\n}\n\nexport const build = async (\n diff: Diff,\n packageJson: PackageJson,\n scurry: PathScurry,\n allowScriptsNodes: Set<DepID>,\n): Promise<BuildResult> => {\n const graph = diff.to\n const nodes = nonEmptyList([...graph.importers])\n const res: BuildResult = { success: [], failure: [] }\n\n // determine if scripts should run - check if node is in allowed set\n const shouldRunScripts = (node: Node): boolean =>\n allowScriptsNodes.has(node.id)\n\n /* c8 ignore next - all graphs have at least one importer */\n if (!nodes) return res\n\n await graphRun<Node, unknown>({\n graph: nodes,\n visit: async (node: Node, signal, path) => {\n // if it's not an importer or an added node, nothing to do.\n // TODO: only build importers if it has changed deps, there's never\n // been a previous build, or it contains something newer than the\n // most recent build.\n // For now, just always build all importers, because we don't\n // track all that other stuff.\n\n if (\n !node.importer &&\n (!diff.nodes.add.has(node) || !shouldRunScripts(node))\n )\n return\n\n try {\n await visit(packageJson, scurry, node, signal, path)\n if (!node.importer) {\n node.buildState = 'built'\n res.success.push(node)\n }\n /* c8 ignore start - windows on CI is missing those tests */\n } catch (err) {\n // Check if this is an optional failure that was handled\n if (node.optional) {\n node.buildState = 'failed'\n res.failure.push(node)\n // Let optionalFail handle the error\n await Promise.reject(err).catch(optionalFail(diff, node))\n } else {\n // Re-throw non-optional failures\n throw err\n }\n }\n /* c8 ignore stop */\n },\n\n getDeps: node => {\n const deps: Node[] = []\n for (const { to } of node.edgesOut.values()) {\n /* c8 ignore next - vanishingly unlikely in practice */\n if (to) deps.push(to)\n }\n return deps\n },\n })\n\n return res\n}\n\nconst visit = async (\n packageJson: PackageJson,\n scurry: PathScurry,\n node: Node,\n signal: AbortSignal,\n _path: Node[],\n): Promise<void> => {\n // at this point we might have to read the manifest from disk if it's\n // currently nullish, that could happen in a scenario where the ideal\n // graph is from a lockfile and there's no actual graph available\n // to hydrate the manifest data from.\n node.manifest ??= packageJson.read(node.resolvedLocation(scurry))\n const { manifest } = node\n const { scripts = {} } = manifest\n\n const {\n install,\n preinstall,\n postinstall,\n prepare,\n preprepare,\n postprepare,\n } = scripts\n\n // Check for binding.gyp file (npm's implicit install detection)\n // \"If there is a binding.gyp file in the root of your package and you\n // haven't defined your own install or preinstall scripts, npm will default\n // the install command to compile using node-gyp via node-gyp rebuild\"\n const hasBindingGyp =\n scurry\n .lstatSync(join(node.resolvedLocation(scurry), 'binding.gyp'))\n ?.isFile() ?? false\n const hasImplicitInstall = hasBindingGyp && !install && !preinstall\n\n // if it has install script or binding.gyp (implicit install), run it\n const runInstall =\n !!(install || preinstall || postinstall) || hasImplicitInstall\n if (runInstall) {\n await run({\n signal,\n arg0: 'install',\n ignoreMissing: true,\n packageJson,\n cwd: node.resolvedLocation(scurry),\n projectRoot: node.projectRoot,\n manifest,\n })\n }\n\n // if it's an importer or git, run prepare\n const prepable =\n node.id.startsWith('git') || node.importer || !node.inVltStore()\n const runPrepare =\n !!(prepare || preprepare || postprepare) && prepable\n\n if (runPrepare) {\n await run({\n signal,\n arg0: 'prepare',\n ignoreMissing: true,\n packageJson,\n cwd: node.resolvedLocation(scurry),\n projectRoot: node.projectRoot,\n manifest,\n })\n }\n\n await binChmod(node, scurry)\n}\n", "export const isNonEmptyList = <T>(\n list: T[],\n): list is [first: T, ...rest: T[]] => !!list.length\n\nexport const nonEmptyList = <T>(nodes: T[]) =>\n isNonEmptyList(nodes) ? nodes : undefined\n", "import type { Graph } from './graph.ts'\nimport type { Node } from './node.ts'\n\n/**\n * Remove the affected optional nodes starting from a given optional node\n * that failed to resolve/install.\n *\n * Removing these dependents will frequently leave optional *dependencies*\n * behind that are made unreachable from any project importer. For performance\n * reasons, `graph.gc()` is not called automatically by this method, since\n * multiple optional subgraphs may need to be removed in a single operation,\n * and the mark-and-sweep garbage collection (a) can be excessively expensive,\n * and (b) may need to communicate the set of garbage-collected nodes\n * for cleanup (as in the case of optional node build failures during\n * reification).\n */\nexport const removeOptionalSubgraph = (\n graph: Graph,\n startingNode: Node & { optional: true },\n) => {\n const removed = new Set<Node>()\n for (const node of findOptionalSubgraph(startingNode)) {\n graph.removeNode(node, undefined, true)\n removed.add(node)\n }\n return removed\n}\n\n/**\n * Given a starting node, this generator will walk back from the optional node\n * to all of its optional dependents, emitting each one, and skipping any\n * cycles.\n *\n * Note that when these are removed, it may create unreachable nodes in the\n * graph! Be sure to call `graph.gc()` if these are removed.\n */\nexport function* findOptionalSubgraph(\n node: Node & { optional: true },\n seen = new Set<Node & { optional: true }>(),\n): Generator<Node & { optional: true }, void> {\n // already visited, prevent looping\n if (seen.has(node)) return\n\n // the node itself is part of the subgraph, of course\n seen.add(node)\n yield node\n\n // and any of its dependents that are also optional\n for (const { from, optional } of node.edgesIn) {\n // if it's an optional *edge*, we don't need to remove it, because it\n // doesn't need the node anyway. But if the node is optional and the\n // dep isn't, then we do need to remove it.\n if (from.isOptional() && !optional) {\n for (const dep of findOptionalSubgraph(from, seen)) yield dep\n }\n }\n}\n", "import type { Diff } from '../diff.ts'\nimport type { Node } from '../node.ts'\nimport { removeOptionalSubgraph } from '../remove-optional-subgraph.ts'\n\n/**\n * If the node is optional, then returns an error handler that removes\n * the node and its connected optional subgraph, by moving them into the\n * \"deleted\" portion of the Diff object.\n * Otherwise, it returns `undefined` so that the promise will simply reject.\n */\nexport function optionalFail(\n diff: Diff,\n node: Node & { optional: true },\n): () => void\nexport function optionalFail(\n diff: Diff,\n node: Node & { optional: false },\n): undefined\nexport function optionalFail(\n diff: Diff,\n node: Node,\n): (() => void) | undefined\nexport function optionalFail(\n diff: Diff,\n node: Node,\n): (() => void) | undefined {\n return node.isOptional() ? () => del(diff, node) : undefined\n}\n\nconst del = (diff: Diff, node: Node & { optional: true }) => {\n diff.hadOptionalFailures = true\n for (const del of removeOptionalSubgraph(diff.to, node)) {\n // add it to the set of nodes being deleted\n diff.nodes.delete.add(del)\n // delete it from the set of nodes being added\n diff.nodes.add.delete(del)\n }\n diff.nodes.add.delete(node)\n diff.nodes.delete.add(node)\n}\n", "import { statSync, existsSync } from 'node:fs'\nimport { chmod } from 'node:fs/promises'\nimport type { PathScurry } from 'path-scurry'\nimport type { Node } from '../node.ts'\n\n/**\n * Make all the packages' bins executable.\n */\nexport const binChmodAll = async (\n nodes: Iterable<Node>,\n scurry: PathScurry,\n): Promise<void> => {\n const chmods: Promise<void>[] = []\n for (const node of nodes) {\n chmods.push(binChmod(node, scurry))\n }\n await Promise.all(chmods)\n}\n\n/**\n * Make all the package's bins executable.\n */\nexport const binChmod = async (\n node: Node,\n scurry: PathScurry,\n): Promise<void> => {\n const chmods: Promise<void>[] = []\n if (!node.bins) return\n for (const bin of Object.values(node.bins)) {\n const path = scurry.resolve(\n `${node.resolvedLocation(scurry)}/${bin}`,\n )\n // only try to make executable if the file exists\n if (existsSync(path)) {\n chmods.push(makeExecutable(path))\n }\n }\n await Promise.all(chmods)\n}\n\n// 0 is \"not yet set\"\n// This is defined by doing `0o111 | <mode>` so that systems\n// that create files group-writable result in 0o775 instead of 0o755\nlet execMode = 0\nconst makeExecutable = async (path: string) => {\n if (!execMode) {\n execMode = (statSync(path).mode & 0o777) | 0o111\n }\n await chmod(path, execMode)\n}\n", "import { error } from '@vltpkg/error-cause'\nimport type { InspectOptions } from 'node:util'\nimport type { Edge } from './edge.ts'\nimport type { Graph } from './graph.ts'\nimport type { Node } from './node.ts'\n\n// XXX should file deps *always* be considered changed?\n// unless the thing containing it wasn't possibly changed because it's inside\n// a dep that didn't change?\n// Same with remote deps\n\nconst kCustomInspect = Symbol.for('nodejs.util.inspect.custom')\n\n/**\n * A Diff object is a representation of a set of changes from one\n * graph to another, typically from the actual graph as it is reified\n * on disk, to an intended ideal graph.\n *\n * The naming convention can get a bit confusing here, because it's a\n * set of directed changes from one set of directed objects to another.\n *\n * Within the context the Diff object, `from` is the Graph we're coming from,\n * and `to` is the Graph we're trying to create.\n */\nexport class Diff {\n from: Graph\n to: Graph\n\n projectRoot: string\n\n /**\n * If changes need to be made later for failures of optional nodes,\n * set this flag so that we know to call graph.gc() at the appropriate time.\n */\n hadOptionalFailures = false\n\n /**\n * Collection of nodes to add and delete\n */\n nodes = {\n /** Nodes in the `to` graph that are not in the `from` graph */\n add: new Set<Node>(),\n /** Nodes in the `from` graph that are not in the `to` graph */\n delete: new Set<Node>(),\n }\n\n /**\n * Collection of nodes to add and delete\n */\n edges = {\n /** Edges in the `to` graph that are not found in the `from` graph */\n add: new Set<Edge>(),\n /** Edges in the `from` graph that are not found in the `to` graph */\n delete: new Set<Edge>(),\n }\n\n /**\n * True if the diff only contains optional nodes (computed during construction)\n */\n optionalOnly = true\n\n get [Symbol.toStringTag]() {\n return '@vltpkg/graph.Diff'\n }\n\n constructor(from: Graph, to: Graph) {\n this.from = from\n this.to = to\n this.projectRoot = from.projectRoot\n if (to.projectRoot !== from.projectRoot) {\n throw error('projectRoot mismatch in Graph diff', {\n wanted: from.projectRoot,\n found: to.projectRoot,\n })\n }\n\n for (const [id, node] of this.from.nodes) {\n if (!this.to.nodes.get(id)?.equals(node)) {\n this.nodes.delete.add(node)\n }\n }\n\n for (const [id, node] of this.to.nodes) {\n if (!this.from.nodes.get(id)?.equals(node)) {\n this.nodes.add.add(node)\n if (!node.optional) {\n this.optionalOnly = false\n }\n }\n }\n\n for (const edge of this.to.edges) {\n // the node with this dep, in the from graph\n const fromNode = this.from.nodes.get(edge.from.id)\n const fromEdge = fromNode?.edgesOut.get(edge.spec.name)\n if (fromEdge?.to?.id === edge.to?.id) continue\n if (fromEdge?.to) this.edges.delete.add(fromEdge)\n if (edge.to) this.edges.add.add(edge)\n }\n for (const edge of this.from.edges) {\n // the node with this dep, in the to graph\n const toNode = this.to.nodes.get(edge.from.id)\n const toEdge = toNode?.edgesOut.get(edge.spec.name)\n if (toEdge?.to?.id === edge.to?.id) continue\n if (edge.to) this.edges.delete.add(edge)\n if (toEdge?.to) this.edges.add.add(toEdge)\n }\n }\n\n [kCustomInspect](_: number, options?: InspectOptions): string {\n const red: [string, string] =\n options?.colors ? ['\\x1b[31m', '\\x1b[m'] : ['', '']\n const green: [string, string] =\n options?.colors ? ['\\x1b[32m', '\\x1b[m'] : ['', '']\n const lines: string[] = []\n for (const node of this.nodes.add) {\n lines.push(`+ ${node.id}`)\n }\n for (const node of this.nodes.delete) {\n lines.push(`- ${node.id}`)\n }\n for (const edge of this.edges.add) {\n /* c8 ignore next */\n const to = edge.to?.id ?? ''\n lines.push(\n `+ ${edge.from.id} ${edge.type} ${edge.spec} ${to}`.trim(),\n )\n }\n for (const edge of this.edges.delete) {\n /* c8 ignore next */\n const to = edge.to?.id ?? ''\n lines.push(\n `- ${edge.from.id} ${edge.type} ${edge.spec} ${to}`.trim(),\n )\n }\n const wrap = (s: string, c: [string, string]) => c.join(s)\n const color =\n options?.colors ?\n (s: string) => wrap(s, s.startsWith('+') ? green : red)\n : (s: string) => s\n\n return `${this[Symbol.toStringTag]} {\n${lines\n .sort((a, b) => a.substring(1).localeCompare(b.substring(1), 'en'))\n .map(s => ' ' + color(s))\n .join('\\n')}\n}`\n }\n\n hasChanges(): boolean {\n return (\n this.nodes.add.size > 0 ||\n this.nodes.delete.size > 0 ||\n this.edges.add.size > 0 ||\n this.edges.delete.size > 0\n )\n }\n\n toJSON() {\n return {\n nodes: {\n add: [...this.nodes.add].map(node => node.toJSON()),\n delete: [...this.nodes.delete].map(node => node.toJSON()),\n },\n edges: {\n add: [...this.edges.add].map(edge => edge.toJSON()),\n delete: [...this.edges.delete].map(edge => edge.toJSON()),\n },\n }\n }\n}\n", "import { Monorepo } from '@vltpkg/workspaces'\nimport { load as loadActual } from './actual/load.ts'\nimport { build as reifyBuild } from './reify/build.ts'\nimport type { BuildResult } from './reify/build.ts'\nimport { Diff } from './diff.ts'\nimport { Graph } from './graph.ts'\nimport { Query } from '@vltpkg/query'\nimport { SecurityArchive } from '@vltpkg/security-archive'\nimport type { LoadOptions } from './actual/load.ts'\nimport type { DepID } from '@vltpkg/dep-id'\nimport type { NodeLike } from '@vltpkg/types'\nimport { saveHidden } from './lockfile/save.ts'\n\n/**\n * Options for the build process\n */\nexport interface BuildOptions extends LoadOptions {\n /**\n * Optional monorepo configuration. If not provided, will attempt to load from project.\n */\n monorepo?: Monorepo\n /**\n * DSS query string to filter which nodes to build.\n */\n target: string\n}\n\n/**\n * Filter nodes using a DSS query string\n */\nconst filterNodesByQuery = async (\n targetQuery: string,\n graph: Graph,\n): Promise<Set<DepID>> => {\n /* c8 ignore start */\n const securityArchive =\n Query.hasSecuritySelectors(targetQuery) ?\n await SecurityArchive.start({\n nodes: [...graph.nodes.values()],\n })\n : undefined\n /* c8 ignore stop */\n\n const edges = graph.edges\n const nodes = new Set<NodeLike>(graph.nodes.values())\n const importers = graph.importers\n\n const query = new Query({\n edges,\n nodes,\n importers,\n securityArchive,\n })\n\n const { nodes: resultNodes } = await query.search(targetQuery, {\n signal: new AbortController().signal,\n })\n\n return new Set(resultNodes.map(node => node.id))\n}\n\n/**\n * Build the project based on actual graph state and build state from lockfile\n *\n * This function:\n * 1. Loads the actual graph from node_modules\n * 2. Loads build data from lockfile and transfers it to the actual graph\n * 3. Constructs a Diff object representing what needs to be built\n * 4. Filters nodes based on buildState === 'needed'\n * 5. Calls the reify build process with the constructed diff\n * 6. Persists build results to lockfile\n */\nexport const build = async (\n options: BuildOptions,\n): Promise<BuildResult> => {\n const {\n projectRoot,\n packageJson,\n monorepo = Monorepo.maybeLoad(projectRoot),\n scurry,\n mainManifest = packageJson.read(projectRoot),\n target,\n ...loadOptions\n } = options\n\n // Load the actual graph from node_modules\n const actualGraph = loadActual({\n ...loadOptions,\n projectRoot,\n packageJson,\n monorepo,\n scurry,\n loadManifests: true,\n })\n\n // Filter nodes using target query provided\n const targetFilteredNodes: Set<DepID> = await filterNodesByQuery(\n target,\n actualGraph,\n )\n\n // Create a total diff including the actual graph as 'to'\n const diff = new Diff(\n new Graph({\n ...options,\n projectRoot,\n monorepo,\n mainManifest,\n }),\n actualGraph,\n )\n\n // Now tweak the diff object to only include the nodes that need to be built\n // Filter by buildState === 'needed' and target query\n diff.nodes.add = new Set(\n [...diff.nodes.add].filter(node => node.buildState === 'needed'),\n )\n\n // Call the reify build process with the constructed diff\n // this will only build the nodes that need to be built\n // as part of `diff.nodes.add`\n const buildResult = await reifyBuild(\n diff,\n packageJson,\n scurry,\n targetFilteredNodes,\n )\n\n // Save hidden lockfile with updated buildState\n saveHidden({\n ...options,\n graph: actualGraph,\n })\n\n return buildResult\n}\n", "import type { DepID } from '@vltpkg/dep-id'\nimport type { EdgeLike, NodeLike } from '@vltpkg/types'\n\n/**\n * A JSON output item describes a package that is present in the install\n * graph. It represents an edge plus it's linking Node.\n */\nexport type JSONOutputItem = {\n /**\n * The name of the package.\n */\n name: string\n /**\n * A reference to the id of the Node that this package is linked from.\n */\n fromID?: DepID\n /**\n * The dependency spec definition for this package.\n */\n spec?: string\n /**\n * The package type.\n */\n type?: EdgeLike['type']\n /**\n * A representation of the package object that fulfills this dependency.\n */\n to?: NodeLike\n /**\n * Whether this edge was overridden by a graph modifier.\n */\n overridden: boolean\n}\n\nexport type JSONOutputGraph = {\n edges: EdgeLike[]\n nodes: NodeLike[]\n importers: Set<NodeLike>\n}\n\n/**\n * Returns a JSON string representation of the graph.\n */\nexport function jsonOutput({\n edges,\n nodes,\n importers,\n}: JSONOutputGraph) {\n const res: JSONOutputItem[] = []\n const seenIds = new Set<DepID>()\n\n // Collects edge & it's linked nodes as json output items\n const orderedEdges = [...edges].sort((a, b) => {\n const aIsWorkspace = a.spec.type === 'workspace'\n const bIsWorkspace = b.spec.type === 'workspace'\n if (aIsWorkspace && !bIsWorkspace) return -1\n /* c8 ignore next */\n if (!aIsWorkspace && bIsWorkspace) return 1\n return 0 // preserve original order otherwise\n })\n for (const edge of orderedEdges) {\n if (edge.to) seenIds.add(edge.to.id)\n res.push({\n name: edge.name,\n fromID: edge.from.id,\n spec: String(edge.spec),\n type: edge.type,\n to: edge.to,\n overridden: edge.spec.overridden,\n })\n }\n\n // Collects included importer nodes json output items\n /* c8 ignore next 3 */\n const orderedImporters = [...importers].sort((a, b) => {\n if (!a.name) return 1\n if (!b.name) return -1\n return a.name.localeCompare(b.name)\n })\n for (const node of orderedImporters) {\n if (!nodes.includes(node) || seenIds.has(node.id)) continue\n res.unshift({\n /* c8 ignore next - name can't be missing but ts won't know */\n name: node.name || node.id,\n to: node,\n overridden: false,\n })\n }\n\n return res\n}\n", "import { defaultRegistryName } from '@vltpkg/spec'\nimport { splitDepID } from '@vltpkg/dep-id'\nimport type { EdgeLike, NodeLike } from '@vltpkg/types'\nimport { styleText as utilStyleText } from 'node:util'\n\nconst styleText = (\n format: Parameters<typeof utilStyleText>[0],\n s: string,\n) => utilStyleText(format, s, { validateStream: false })\n\nconst chars = new Map(\n Object.entries({\n connection: '\u2500',\n down: '\u2502',\n 'last-child': '\u2514',\n 'middle-child': '\u251C',\n t: '\u252C',\n }),\n)\n\nexport type TreeItem = {\n name?: string | null\n edge: EdgeLike | undefined\n node: NodeLike | undefined\n prefix: string\n padding: string\n hasSibling: boolean\n seen: boolean\n include: boolean\n parent: TreeItem | undefined\n}\n\nexport type HumanReadableOutputGraph = {\n edges: EdgeLike[]\n importers: Set<NodeLike>\n nodes: NodeLike[]\n highlightSelection?: boolean\n}\n\nexport type EdgeMap = Map<NodeLike | undefined, TreeItem>\n\nexport type TreeMap = Map<EdgeLike | undefined, EdgeMap>\n\nconst isSelected = (\n options: HumanReadableOutputGraph,\n edge?: EdgeLike,\n node?: NodeLike,\n) =>\n (!node || options.nodes.includes(node)) &&\n (!edge || options.edges.includes(edge))\n\n/**\n * Returns a map of tree items to be printed.\n */\nconst getTreeItems = (\n initialItems: Set<TreeItem>,\n options: HumanReadableOutputGraph,\n) => {\n const seenNodes = new Set<NodeLike>()\n const treeItems: TreeMap = new Map()\n const traverse = new Set<TreeItem>(initialItems)\n for (const item of traverse) {\n if (item.node) {\n if (seenNodes.has(item.node)) {\n item.seen = true\n continue\n }\n seenNodes.add(item.node)\n const edges = [...item.node.edgesOut.values()]\n const workspaces =\n item.node.workspaces ? [...item.node.workspaces.values()] : []\n const allEdges = [...edges, ...workspaces].sort((a, b) =>\n a.name.localeCompare(b.name, 'en'),\n )\n\n // keeps track of seen edge names to avoid duplicating printed\n // items when a workspace is also a regular dependency of the root\n const seenEdgeName = new Set<string>()\n for (const edge of allEdges) {\n if (seenEdgeName.has(edge.name)) {\n continue\n }\n seenEdgeName.add(edge.name)\n const toItems: EdgeMap =\n treeItems.get(edge) ?? (new Map() as EdgeMap)\n const nextItem: TreeItem = {\n edge,\n node: edge.to,\n hasSibling: false,\n padding: '',\n prefix: '',\n seen: false,\n include: isSelected(options, edge, edge.to),\n parent: item,\n }\n toItems.set(edge.to, nextItem)\n treeItems.set(edge, toItems)\n traverse.add(nextItem)\n }\n }\n }\n for (const item of [...traverse].reverse()) {\n if (item.include && item.parent) {\n item.parent.include = true\n }\n }\n return treeItems\n}\n\n/**\n * Returns a human-readable output of the graph.\n */\nexport function humanReadableOutput(\n options: HumanReadableOutputGraph,\n { colors }: { colors?: boolean },\n) {\n const { importers } = options\n const createStyleText =\n (style: Parameters<typeof styleText>[0]) => (s: string) =>\n colors ? styleText(style, s) : s\n const dim = createStyleText('dim')\n const red = createStyleText('red')\n const reset = createStyleText('reset')\n const yellow = createStyleText('yellow')\n const initialItems = new Set<TreeItem>()\n for (const importer of importers) {\n initialItems.add({\n name: importer.name,\n edge: undefined,\n node: importer,\n prefix: '',\n padding: '',\n hasSibling: false,\n seen: false,\n include: isSelected(options, undefined, importer),\n parent: undefined,\n })\n }\n const treeItems = getTreeItems(initialItems, options)\n\n let res = ''\n const traverse = (item: TreeItem) => {\n let header = ''\n let content = ''\n\n const name = item.name\n const decoratedName =\n (\n options.highlightSelection &&\n isSelected(options, item.edge, item.node) &&\n name\n ) ?\n yellow(name)\n : name\n if (!item.node && item.include) {\n const missing =\n item.edge?.type.endsWith('ptional') ?\n dim('(missing optional)')\n : red('(missing)')\n return `${item.padding}${item.prefix}${decoratedName} ${missing}\\n`\n }\n\n header += `${item.padding}${item.prefix}${decoratedName}\\n`\n\n // seen items need not to be printed or traversed\n if (!item.seen) {\n const edges = item.node ? [...item.node.edgesOut.values()] : []\n const workspaces =\n item.node?.workspaces ?\n [...item.node.workspaces.values()]\n : []\n const allEdges = [...edges, ...workspaces].sort((a, b) =>\n a.name.localeCompare(b.name, 'en'),\n )\n const nextItems = allEdges.map(i => treeItems.get(i)?.get(i.to))\n const includedItems = nextItems.filter(i => i?.include)\n\n for (const nextItem of nextItems) {\n /* c8 ignore next -- impossible but TS doesn't know that */\n if (!nextItem) continue\n\n const parent = item\n const isLast =\n includedItems.indexOf(nextItem) === includedItems.length - 1\n\n // prefixes the node name with the registry name\n // if a custom registry name is found\n const depIdTuple =\n nextItem.node?.id && splitDepID(nextItem.node.id)\n const hasCustomReg =\n depIdTuple?.[0] === 'registry' &&\n depIdTuple[1] &&\n depIdTuple[1] !== defaultRegistryName\n const nodeName =\n hasCustomReg ?\n `${depIdTuple[1]}:${nextItem.node?.name}`\n : nextItem.node?.name\n\n const toName =\n nextItem.node?.version ?\n `${nodeName}@${nextItem.node.version}`\n : nodeName\n const nextChar = isLast ? 'last-child' : 'middle-child'\n\n const aliasedPackage =\n hasCustomReg ||\n (nextItem.node?.name &&\n nextItem.edge?.name !== nextItem.node.name)\n nextItem.name =\n nextItem.node?.confused ?\n `${nextItem.edge?.name} ${red('(confused)')}`\n : nextItem.edge?.spec.overridden ?\n /* c8 ignore next */\n `${nextItem.edge.name}@${nextItem.node?.version || nextItem.edge.spec.bareSpec}${aliasedPackage ? ` (${toName})` : ''} ${yellow('(overridden)')}`\n : aliasedPackage ? `${nextItem.edge?.name} (${toName})`\n : `${nextItem.edge?.name}@${nextItem.node?.version || nextItem.edge?.spec.bareSpec}`\n nextItem.padding =\n parent.prefix.length ?\n `${parent.padding}${parent.hasSibling ? chars.get('down') : ' '} `\n : ''\n nextItem.prefix = `${chars.get(nextChar)}${chars.get('connection')}${chars.get('connection')} `\n nextItem.hasSibling = !isLast\n\n content += traverse(nextItem)\n }\n }\n\n const regularConnection = `${chars.get('connection')} `\n const parentConnection = `${chars.get('t')} `\n return item.include ?\n `${content ? header.replace(regularConnection, parentConnection) : header}${content}`\n : ''\n }\n\n for (const item of initialItems) {\n res += traverse(item)\n }\n return reset(res)\n}\n", "import type { DepID } from '@vltpkg/dep-id'\nimport { Edge } from '../edge.ts'\nimport { Node } from '../node.ts'\nimport type { EdgeLike, NodeLike } from '@vltpkg/types'\n\nexport type MermaidOutputGraph = {\n edges: EdgeLike[]\n importers: Set<NodeLike>\n nodes: NodeLike[]\n}\n\ntype TraverseItem = {\n self: EdgeLike | NodeLike\n parent: EdgeLike | NodeLike | undefined\n}\n\nlet missingCount = 0\n\n/**\n * Generates a short identifier for a given index following the pattern:\n * 0 -> a, 1 -> b, ..., 25 -> z, 26 -> A, ..., 51 -> Z, 52 -> aa, 53 -> ab, etc.\n * This implements a bijective base-52 numbering system where a-z = 0-25, A-Z = 26-51\n */\nexport function generateShortId(index: number): string {\n const base = 52\n\n // Helper function to convert a digit (0-51) to character\n const digitToChar = (digit: number): string => {\n if (digit < 26) {\n // a-z (0-25)\n return String.fromCharCode(97 + digit)\n } else {\n // A-Z (26-51)\n return String.fromCharCode(65 + (digit - 26))\n }\n }\n\n // Bijective base-52 conversion\n let result = ''\n let num = index + 1 // Convert to 1-based for bijective base\n\n while (num > 0) {\n num-- // Adjust for 0-based indexing in each position\n const remainder = num % base\n result = digitToChar(remainder) + result\n num = Math.floor(num / base)\n }\n\n return result\n}\n\n/**\n * Creates a mapping from DepID to short identifier\n */\nfunction createDepIdMapping(\n importers: Set<NodeLike>,\n): Map<DepID, string> {\n const mapping = new Map<DepID, string>()\n const uniqueDepIds = new Set<DepID>()\n\n // Collect all unique DepIDs from nodes & importers\n const [importer] = importers\n if (importer) {\n for (const node of importer.graph.nodes.values()) {\n uniqueDepIds.add(node.id)\n }\n }\n\n // Create mapping for each unique DepID\n let index = 0\n for (const depId of uniqueDepIds) {\n mapping.set(depId, generateShortId(index++))\n }\n\n return mapping\n}\n\n/**\n * Returns a node reference: on the first occurrence of a node, returns the full label;\n * on subsequent occurrences, returns just the shortId.\n *\n * Note: Mutates the `labeledNodes` set as a side effect to track which nodes have already\n * been labeled. This tracking is shared across multiple importers to prevent duplicate\n * labels in the output.\n */\nconst nodeRef = (\n node: NodeLike,\n labeledNodes: Set<DepID>,\n depIdMapping: Map<DepID, string>,\n): string => {\n const shortId =\n depIdMapping.get(\n node.id,\n ) /* c8 ignore next - should not be possible */ ?? ''\n if (labeledNodes.has(node.id)) {\n return shortId\n }\n labeledNodes.add(node.id)\n return `${shortId}(\"${String(node).replaceAll('@', '#64;')}\")`\n}\n\nfunction parseNode(\n seenNodes: Set<DepID>,\n labeledNodes: Set<DepID>,\n includedItems: Map<EdgeLike | NodeLike, boolean>,\n depIdMapping: Map<DepID, string>,\n node: NodeLike,\n isImporter = false,\n) {\n if (seenNodes.has(node.id) || !includedItems.get(node)) {\n return ''\n }\n seenNodes.add(node.id)\n // For importers, render the node label first as a standalone line before processing edges,\n // since they appear at the top of the graph. Non-importer nodes are labeled inline as part of edge definitions.\n const nodeLabel =\n isImporter ? nodeRef(node, labeledNodes, depIdMapping) : ''\n // Include both regular edges and workspace edges (if any)\n const allEdges = [\n ...node.edgesOut.values(),\n ...(node.workspaces?.values() ?? []),\n ]\n const edges: string = allEdges\n .map(e =>\n parseEdge(\n seenNodes,\n labeledNodes,\n includedItems,\n depIdMapping,\n e,\n ),\n )\n .filter(Boolean)\n .join('\\n')\n // Only render node standalone for importers, others are rendered as part of edges\n if (isImporter) {\n /* c8 ignore next */\n return `${nodeLabel}${edges.length ? '\\n' : ''}${edges}`\n }\n return edges\n}\n\nfunction parseEdge(\n seenNodes: Set<DepID>,\n labeledNodes: Set<DepID>,\n includedItems: Map<EdgeLike | NodeLike, boolean>,\n depIdMapping: Map<DepID, string>,\n edge: EdgeLike,\n) {\n if (!includedItems.get(edge)) {\n return ''\n }\n\n const edgeType = edge.type === 'prod' ? '' : ` (${edge.type})`\n const edgeResult =\n nodeRef(edge.from, labeledNodes, depIdMapping) +\n ` -->|\"${String(edge.spec).replaceAll('@', '#64;')}${edgeType}\"| `\n\n const missingLabel =\n edge.type.endsWith('ptional') ? 'Missing Optional' : 'Missing'\n if (!edge.to) {\n return edgeResult + `missing-${missingCount++}(${missingLabel})`\n }\n\n // Label the target node first so that if it's referenced again later in the graph,\n // it will use the short identifier instead of repeating the full label.\n const toRef = nodeRef(edge.to, labeledNodes, depIdMapping)\n const childEdges = parseNode(\n seenNodes,\n labeledNodes,\n includedItems,\n depIdMapping,\n edge.to,\n )\n return edgeResult + toRef + (childEdges ? '\\n' + childEdges : '')\n}\n\n/**\n * Returns a mermaid string representation of the graph.\n */\nexport function mermaidOutput({\n edges,\n importers,\n nodes,\n}: MermaidOutputGraph) {\n const seen = new Set<EdgeLike | NodeLike>()\n const includedItems = new Map<EdgeLike | NodeLike, boolean>()\n const traverse = new Set<TraverseItem>(\n [...importers].map(i => ({ self: i, parent: undefined })),\n )\n\n for (const item of traverse) {\n if (seen.has(item.self)) continue\n seen.add(item.self)\n\n if (item.self instanceof Edge) {\n // Workspace edges are stored in mainImporter.workspaces and not in graph.edges,\n // so we need to check for workspace spec type to always include them\n if (\n edges.includes(item.self) ||\n item.self.spec.type === 'workspace'\n ) {\n includedItems.set(item.self, true)\n }\n if (item.self.to) {\n traverse.add({ self: item.self.to, parent: item.self })\n }\n }\n\n if (item.self instanceof Node) {\n if (nodes.includes(item.self)) {\n includedItems.set(item.self, true)\n }\n for (const edge of item.self.edgesOut.values()) {\n traverse.add({ self: edge, parent: item.self })\n }\n // Also traverse workspace edges (only mainImporter has these)\n if (item.self.workspaces) {\n for (const edge of item.self.workspaces.values()) {\n traverse.add({ self: edge, parent: item.self })\n }\n }\n }\n }\n\n for (const item of [...traverse].reverse()) {\n if (includedItems.has(item.self) && item.parent) {\n includedItems.set(item.parent, true)\n }\n }\n\n // Create DepID to short identifier mapping\n const depIdMapping = createDepIdMapping(importers)\n\n // Track nodes that have had their label printed (shared across all importers)\n const labeledNodes = new Set<DepID>()\n\n // Track nodes that have been processed (shared across all importers to avoid duplicates)\n const seenNodes = new Set<DepID>()\n\n return (\n 'flowchart TD\\n' +\n [...importers]\n .map(i =>\n parseNode(\n seenNodes,\n labeledNodes,\n includedItems,\n depIdMapping,\n i,\n true, // isImporter\n ),\n )\n .filter(Boolean)\n .join('\\n')\n )\n}\n", "import { spawn } from 'node:child_process'\nimport { rename } from 'node:fs/promises'\nimport { basename, dirname } from 'node:path'\nimport { pathToFileURL } from 'node:url'\nimport { rimraf } from 'rimraf'\nimport { __CODE_SPLIT_SCRIPT_NAME } from './remove.ts'\n\nconst isDeno =\n (globalThis as typeof globalThis & { Deno?: any }).Deno != undefined\n\nexport class RollbackRemove {\n #key = String(Math.random()).substring(2)\n #paths = new Map<string, string>()\n\n async rm(path: string) {\n if (this.#paths.has(path)) return\n const target = `${dirname(path)}/.VLT.DELETE.${this.#key}.${basename(path)}`\n this.#paths.set(path, target)\n await rename(path, target).catch((e: unknown) => {\n if (\n e instanceof Error &&\n 'code' in e &&\n /* c8 ignore start - very spurious weirdness on Windows */\n (e.code === 'ENOENT' || e.code === 'EPERM')\n /* c8 ignore stop */\n ) {\n this.#paths.delete(path)\n return\n }\n /* c8 ignore next */\n throw e\n })\n }\n\n confirm() {\n // nothing to confirm!\n if (!this.#paths.size) return\n\n const env = { ...process.env }\n const args = []\n // Deno on Windows does not support detached processes\n // https://github.com/denoland/deno/issues/25867\n // TODO: figure out something better to do here?\n const detached = !(isDeno && process.platform === 'win32')\n // When compiled the script to be run is passed as an\n // environment variable and then routed by the main entry point\n if (process.env.__VLT_INTERNAL_COMPILED) {\n env.__VLT_INTERNAL_MAIN = pathToFileURL(\n __CODE_SPLIT_SCRIPT_NAME,\n ).toString()\n } else {\n // If we are running deno from source we need to add the\n // unstable flags we need. The '-A' flag does not need\n // to be passed in as Deno supplies that automatically.\n if (isDeno) {\n args.push(\n '--unstable-node-globals',\n '--unstable-bare-node-builtins',\n )\n }\n args.push(__CODE_SPLIT_SCRIPT_NAME)\n }\n const child = spawn(process.execPath, args, {\n stdio: ['pipe', 'ignore', 'ignore'],\n detached,\n env,\n })\n for (const path of this.#paths.values()) {\n child.stdin.write(`${path}\\0`)\n }\n child.stdin.end()\n if (detached) {\n child.unref()\n }\n this.#paths.clear()\n }\n\n async rollback() {\n const promises: Promise<unknown>[] = []\n for (const [original, moved] of this.#paths) {\n promises.push(\n rimraf(original)\n /* c8 ignore next */\n .catch(() => {})\n .then(() => rename(moved, original)),\n )\n }\n await Promise.all(promises)\n this.#paths.clear()\n }\n}\n", "import {resolve} from \"node:path\";\nexport const __CODE_SPLIT_SCRIPT_NAME = resolve(import.meta.dirname, \"rollback-remove-src-remove.js\");", "import {\n isPostcssNodeWithChildren,\n isPseudoNode,\n isIdentifierNode,\n isCombinatorNode,\n isCommentNode,\n isStringNode,\n isTagNode,\n asStringNode,\n asTagNode,\n parse,\n asPostcssNodeWithChildren,\n} from '@vltpkg/dss-parser'\nimport type { PostcssNode } from '@vltpkg/dss-parser'\nimport { error } from '@vltpkg/error-cause'\nimport { intersects } from '@vltpkg/semver'\nimport type {\n ModifierBreadcrumb,\n ModifierBreadcrumbItem,\n ModifierInteractiveBreadcrumb,\n BreadcrumbSpecificity,\n ModifierComparatorOptions,\n InternalModifierComparatorOptions,\n} from './types.ts'\n\nexport * from './types.ts'\n\n/**\n * The returned pseudo selector parameters object.\n */\ntype ParsedPseudoParameters = {\n semverValue?: string\n}\n\n/**\n * The higher level function for pseudo selectors comparators.\n */\ntype PseudoSelectorsComparatorFn = (\n internal: InternalModifierComparatorOptions,\n) => (opts: ModifierComparatorOptions) => boolean\n\n/**\n * A comparator function that always returns true.\n */\nconst passthroughComparator = () => () => true\n\n/**\n * A comparator function for semver pseudo selectors.\n */\nconst semverComparator =\n ({ range }: InternalModifierComparatorOptions) =>\n ({ semver }: ModifierComparatorOptions) => {\n if (range && semver) {\n return intersects(semver, range)\n }\n return false\n }\n\n/**\n * A map of pseudo selectors to their comparator functions.\n */\nconst pseudoSelectors = new Map<string, PseudoSelectorsComparatorFn>([\n [':semver', semverComparator],\n [':v', semverComparator],\n])\n\n/**\n * The subset of importer pseudo selectors that are supported.\n */\nconst importerNames = new Set([':project', ':workspace', ':root'])\n\n// Add importer pseudo selectors to the list of supported selectors\nfor (const importerName of importerNames) {\n pseudoSelectors.set(importerName, passthroughComparator)\n}\n\n/**\n * Helper function to remove quotes from a string value.\n */\nexport const removeQuotes = (value: string) =>\n value.replace(/^\"(.*?)\"$/, '$1')\n\n/**\n * Helper function to extract parameter value from pseudo selector nodes.\n */\nexport const extractPseudoParameter = (\n item: any,\n): ParsedPseudoParameters => {\n if (!isPostcssNodeWithChildren(item) || !item.nodes[0]) {\n return {}\n }\n\n let first\n try {\n // Try to parse as string node first (quoted values)\n const firstNode = asPostcssNodeWithChildren(item.nodes[0])\n .nodes[0]\n\n if (isStringNode(firstNode)) {\n first = removeQuotes(firstNode.value)\n }\n\n // Handle tag node (unquoted values)\n if (isTagNode(firstNode)) {\n first = asTagNode(firstNode).value\n }\n } catch {}\n\n if (item.value === ':semver' || item.value === ':v') {\n return {\n semverValue: first,\n }\n }\n\n return {}\n}\n\n/**\n * Helper function to get the full text representation\n * of a pseudo selector including parameters\n */\nexport const getPseudoSelectorFullText = (\n item: PostcssNode,\n): string => {\n if (!isPostcssNodeWithChildren(item) || !item.nodes[0]) {\n return item.value || ''\n }\n\n const baseValue = item.value\n const paramNode = item.nodes[0]\n\n let paramText = ''\n\n if (isPostcssNodeWithChildren(paramNode)) {\n // reconstruct the parameter by combining all child nodes\n paramText = paramNode.nodes\n .map(node => {\n if (isStringNode(node)) {\n return asStringNode(node).value\n } else if (isTagNode(node)) {\n return asTagNode(node).value\n } else {\n return node.value\n }\n })\n .join('')\n }\n\n return `${baseValue}(${paramText})`\n}\n\n/**\n * The Breadcrumb class is used to represent a valid breadcrumb\n * path that helps you traverse a graph and find a specific node or edge.\n *\n * Alongside the traditional analogy, \"Breadcrumb\" is also being used here\n * as a term used to describe the subset of the query language that uses\n * only pseudo selectors, id selectors & combinators.\n *\n * The Breadcrumb class implements a doubly-linked list of items\n * that can be used to navigate through the breadcrumb.\n * The InteractiveBreadcrumb can also be used to keep track of state\n * of the current breadcrumb item that should be used for checks.\n *\n * It also validates that each element of the provided query string is\n * valid according to the previous definition of a \"Breadcrumb\" query\n * language subset.\n */\nexport class Breadcrumb implements ModifierBreadcrumb {\n #items: ModifierBreadcrumbItem[]\n comment: string | undefined\n specificity: BreadcrumbSpecificity\n\n /**\n * Initializes the interactive breadcrumb with a query string.\n */\n\n constructor(query: string) {\n this.#items = []\n this.specificity = { idCounter: 0, commonCounter: 0 }\n const ast = parse(query)\n\n // Track whether we encountered a combinator since the last item\n let afterCombinator = true\n\n // iterates only at the first level of the AST since any\n // pseudo selectors that relies on nested nodes are invalid syntax\n for (const item of ast.first.nodes) {\n const pseudoNode = isPseudoNode(item)\n\n // checks for only supported pseudo selectors\n if (pseudoNode && !pseudoSelectors.has(item.value)) {\n throw error('Invalid pseudo selector', {\n found: item.value,\n })\n }\n\n const allowedTypes =\n isIdentifierNode(item) ||\n pseudoNode ||\n (isCombinatorNode(item) && item.value === '>') ||\n isCommentNode(item)\n const hasChildren =\n isPostcssNodeWithChildren(item) && item.nodes.length > 0\n const semverNode =\n pseudoNode &&\n (item.value === ':semver' || item.value === ':v')\n\n // validation, only pseudo selectors, id selectors\n // and combinators are valid ast node items\n // pseudo selectors are allowed to have children (parameters)\n if ((hasChildren && !pseudoNode) || !allowedTypes) {\n throw error('Invalid query', { found: query })\n }\n\n // combinators and comments are skipped\n if (isCombinatorNode(item)) {\n afterCombinator = true\n continue\n } else if (isCommentNode(item)) {\n const cleanComment = item.value\n .replace(/^\\/\\*/, '')\n .replace(/\\*\\/$/, '')\n .trim()\n this.comment = cleanComment\n afterCombinator = true\n } else {\n // we define the last item as we iterate through the list of\n // breadcrumb items so that this value can also be used to\n // update previous items when needed\n const lastItem =\n this.#items.length > 0 ?\n this.#items[this.#items.length - 1]\n : undefined\n\n // Extract parameter before potential consolidation\n const providedRange: string =\n (\n pseudoNode &&\n (item.value === ':semver' || item.value === ':v')\n ) ?\n (extractPseudoParameter(item).semverValue ?? '')\n : ''\n\n // get the comparator function for a given pseudo selector item\n const internalOptions: InternalModifierComparatorOptions = {\n ...(semverNode ? { range: providedRange } : {}),\n }\n const comparator = (\n pseudoSelectors.get(item.value) ?? passthroughComparator\n )(internalOptions)\n\n // If we have a previous item and we haven't encountered a combinator\n // since then, consolidate with the previous item\n if (lastItem && !afterCombinator) {\n // Check for invalid chained pseudo selectors\n if (pseudoNode && isPseudoNode(lastItem)) {\n throw error('Invalid query', { found: query })\n }\n\n // determine how to combine the values based on selector types\n let currentValue: string = item.value\n if (item.type === 'id') {\n currentValue = `#${item.value}`\n } else if (pseudoNode) {\n currentValue = getPseudoSelectorFullText(item)\n }\n lastItem.value = `${lastItem.value}${currentValue}`\n\n // if current item is an ID, update the name property\n if (isIdentifierNode(item)) {\n lastItem.name = item.value\n }\n\n // Handle comparator and importer when consolidating with pseudo node\n if (pseudoNode) {\n const lastItemComparator = lastItem.comparator\n lastItem.comparator = (opts: ModifierComparatorOptions) =>\n comparator(opts) && lastItemComparator(opts)\n lastItem.importer ||= importerNames.has(item.value)\n }\n\n // update specificity counters\n if (isIdentifierNode(item)) {\n this.specificity.idCounter++\n } else if (pseudoNode) {\n this.specificity.commonCounter++\n }\n\n afterCombinator = false\n continue\n }\n\n // Create a new breadcrumb item\n let itemValue: string = item.value\n if (item.type === 'id') {\n itemValue = `#${item.value}`\n } else if (pseudoNode) {\n itemValue = getPseudoSelectorFullText(item)\n }\n\n const newItem = {\n comparator,\n value: itemValue,\n name: item.type === 'id' ? item.value : undefined,\n type: item.type,\n prev: lastItem,\n next: undefined,\n importer: pseudoNode && importerNames.has(item.value),\n }\n if (lastItem) {\n lastItem.next = newItem\n }\n this.#items.push(newItem)\n\n // Update specificity counters\n if (isIdentifierNode(item)) {\n this.specificity.idCounter++\n } else if (pseudoNode) {\n this.specificity.commonCounter++\n }\n\n afterCombinator = false\n }\n }\n // the parsed query should have at least one item\n // that is then going to be set as the current item\n if (!this.#items[0]) {\n throw error('Failed to parse query', {\n found: query,\n })\n }\n }\n\n /**\n * Retrieves the first breadcrumb item.\n */\n get first(): ModifierBreadcrumbItem {\n if (!this.#items[0]) {\n throw error('Failed to find first breadcrumb item')\n }\n return this.#items[0]\n }\n\n /**\n * Retrieves the last breadcrumb item.\n */\n get last(): ModifierBreadcrumbItem {\n const lastItem = this.#items[this.#items.length - 1]\n if (!lastItem) {\n throw error('Failed to find first breadcrumb item')\n }\n return lastItem\n }\n\n /**\n * Returns `true` if the breadcrumb is composed of a single item.\n */\n get single(): boolean {\n return this.#items.length === 1\n }\n\n [Symbol.iterator]() {\n return this.#items.values()\n }\n\n /**\n * Empties the current breadcrumb list.\n */\n clear() {\n for (const item of this.#items) {\n item.prev = undefined\n item.next = undefined\n }\n this.#items.length = 0\n }\n\n /**\n * Gets an {@link InteractiveBreadcrumb} instance that can be\n * used to track state of the current breadcrumb item.\n */\n interactive() {\n return new InteractiveBreadcrumb(this)\n }\n}\n\n/**\n * The InteractiveBreadcrumb is used to keep track of state\n * of the current breadcrumb item that should be used for checks.\n */\nexport class InteractiveBreadcrumb implements ModifierInteractiveBreadcrumb {\n #current: ModifierBreadcrumbItem | undefined\n constructor(breadcrumb: Breadcrumb) {\n this.#current = breadcrumb.first\n }\n\n /**\n * The current breadcrumb item.\n */\n get current(): ModifierBreadcrumbItem | undefined {\n return this.#current\n }\n\n /**\n * Returns `true` if the current breadcrumb has no more items left.\n */\n get done(): boolean {\n return !this.#current\n }\n\n /**\n * The next breadcrumb item.\n */\n next(): this {\n this.#current = this.#current?.next\n return this\n }\n}\n\n/**\n * Returns an {@link Breadcrumb} list of items\n * for a given query string.\n */\nexport const parseBreadcrumb = (query: string): ModifierBreadcrumb =>\n new Breadcrumb(query)\n\n/**\n * Sorts an array of Breadcrumb objects by specificity. Objects with\n * higher idCounter values come first, if idCounter values are equal,\n * then objects with higher commonCounter values come first. Otherwise,\n * the original order is preserved.\n */\nexport const specificitySort = (\n breadcrumbs: ModifierBreadcrumb[],\n): ModifierBreadcrumb[] => {\n return [...breadcrumbs].sort((a, b) => {\n // First compare by idCounter (higher comes first)\n if (a.specificity.idCounter !== b.specificity.idCounter) {\n return b.specificity.idCounter - a.specificity.idCounter\n }\n\n // If idCounter values are equal, compare by commonCounter\n if (a.specificity.commonCounter !== b.specificity.commonCounter) {\n return b.specificity.commonCounter - a.specificity.commonCounter\n }\n\n // If both counters are equal, preserve original order\n return 0\n })\n}\n", "import {\n parseBreadcrumb,\n specificitySort,\n} from '@vltpkg/dss-breadcrumb'\nimport { error } from '@vltpkg/error-cause'\nimport { Spec } from '@vltpkg/spec'\nimport {\n asNormalizedManifest,\n assertRecordStringString,\n normalizeManifest,\n} from '@vltpkg/types'\nimport { load } from '@vltpkg/vlt-json'\nimport type {\n ModifierBreadcrumb,\n ModifierInteractiveBreadcrumb,\n} from '@vltpkg/dss-breadcrumb'\nimport type { SpecOptions } from '@vltpkg/spec'\nimport type { NormalizedManifest } from '@vltpkg/types'\nimport type { Edge } from './edge.ts'\nimport type { Node } from './node.ts'\nimport type { Dependency } from './dependencies.ts'\n\n/**\n * Loaded modifiers configuration as described in the `vlt.json` file.\n */\nexport type GraphModifierLoadedConfig = {\n modifiers: GraphModifierConfigObject\n}\n\n/**\n * Type definition for the modifiers configuration object\n */\n// TODO: subtype string into a more specific type for Queries\nexport type GraphModifierConfigObject = Record<string, string>\n\n/**\n * Info needed to define a graph modifier.\n */\nexport type BaseModifierEntry = {\n type: 'edge' | 'node'\n query: string\n breadcrumb: ModifierBreadcrumb\n value: string | NormalizedManifest\n refs: Set<{\n name: string\n from: Node\n }>\n}\n\n/**\n * Extra info to define specifically a graph edge modifier.\n */\nexport type EdgeModifierEntry = BaseModifierEntry & {\n type: 'edge'\n spec: Spec\n value: string\n}\n\n/**\n * Extra info to define the graph node modifier.\n */\nexport type NodeModifierEntry = BaseModifierEntry & {\n type: 'node'\n manifest: NormalizedManifest\n}\n\n/**\n * A graph modifier entry, which can be either an edge or a node modifier.\n */\nexport type ModifierEntry = EdgeModifierEntry | NodeModifierEntry\n\n/**\n * An object to track modifiers that have matched an initial part of the\n * breadcrumb. It holds pointers to both nodes and edges matched in the\n * current traversed graph on top of the modifier info and the breadcrumb\n * state that is used to track the current state of the parsing.\n */\nexport type ModifierActiveEntry = {\n /**\n * The modifier this active entry is working with.\n */\n modifier: ModifierEntry\n /**\n * The breadcrumb that is used to track the current state of the parsing.\n */\n interactiveBreadcrumb: ModifierInteractiveBreadcrumb\n /**\n * The first node to be affected by this modifier.\n */\n originalFrom: Node\n /**\n * The original edge that is being replaced with this entry.\n */\n originalEdge?: Edge\n /**\n * The modified edge that is being used to replace the original edge.\n */\n modifiedEdge?: Edge\n}\n\n/**\n * Class representing loaded modifiers configuration for a project.\n *\n * Instances of this class can be used as a helper to modify the graph\n * during the graph build ideal traversal time.\n *\n * ```\n * const modifier = new GraphModifier(options)\n * modifier.load(options)\n * ```\n *\n * The `tryImporter` method can be used to register the initial importer\n * node along with any modifier that includes an importer selector, e.g:\n * `modifier.tryImporter(graph.mainImporter)`\n *\n * When traversing the graph, use the `tryNewDependency` method to check\n * if a given dependency spec to the current traversed node has matching\n * registered modifiers, e.g:\n * `const entries = modifier.tryNewDependency(fromNode, depSpec)`\n *\n * Use `updateActiveEntry` to update a given active modifier entry state\n * with the current node of the graph being traversed. e.g:\n * ```\n * for (const entry of entries)\n * modifier.updateActiveEntry(fromNode, entry)\n * ```\n */\nexport class GraphModifier {\n /** The loaded modifiers configuration */\n #config?: GraphModifierConfigObject\n /** A set of all modifiers loaded from vlt.json */\n #modifiers = new Set<ModifierEntry>()\n /** A set of all edge modifiers loaded from vlt.json */\n #edgeModifiers = new Set<EdgeModifierEntry>()\n /** A set of all node modifiers loaded from vlt.json */\n #nodeModifiers = new Set<NodeModifierEntry>()\n /**\n * A map of initial entries, keyed by the name of the first breadcrumb\n * item to its modifier entry. Useful for checking for non-importer\n * starting breadcrumbs, e.g: `#a > #b`\n */\n #initialEntries = new Map<string, Set<ModifierEntry>>()\n /**\n * A multi-level map of active entries, keyed by:\n * - modifiers\n * - edge name\n * - from node\n * that allows for retrieving seen {@link ModifierActiveEntry} instances\n * in constant time.\n */\n #activeEntries = new Map<\n ModifierEntry,\n Map<string, Map<Node, ModifierActiveEntry>>\n >()\n /**\n * A set of currently active modifiers, which are being parsed.\n */\n activeModifiers = new Set<ModifierActiveEntry>()\n /** A set of all modifier string values loaded from vlt.json */\n modifierNames = new Set<string>()\n\n constructor(options: SpecOptions) {\n this.load(options)\n }\n\n /**\n * Load the modifiers definitions from vlt.json,\n * converting the result into a GraphModifierConfigObject\n */\n get config(): GraphModifierConfigObject {\n if (this.#config) return this.#config\n return (this.#config =\n load('modifiers', assertRecordStringString) ?? {})\n }\n\n /**\n * Loads the modifiers defined in `vlt.json` into memory.\n */\n load(options: SpecOptions) {\n for (const [key, value] of Object.entries(this.config)) {\n this.modifierNames.add(key)\n const breadcrumb = parseBreadcrumb(key)\n /* c8 ignore start - should not be possible */\n if (!breadcrumb.last.name) {\n throw error('Could not find name in breadcrumb', {\n found: key,\n })\n }\n /* c8 ignore stop */\n let mod: ModifierEntry\n if (typeof value === 'string') {\n mod = {\n breadcrumb,\n query: key,\n refs: new Set(),\n spec: Spec.parse(breadcrumb.last.name, value, options),\n type: 'edge',\n value,\n } satisfies EdgeModifierEntry\n this.#edgeModifiers.add(mod)\n /* c8 ignore start - TODO */\n } else {\n const manifest = asNormalizedManifest(\n normalizeManifest(value),\n )\n mod = {\n breadcrumb,\n query: key,\n manifest,\n refs: new Set(),\n type: 'node',\n value: manifest,\n } satisfies NodeModifierEntry\n this.#nodeModifiers.add(mod)\n }\n /* c8 ignore end */\n this.#modifiers.add(mod)\n // if the breadcrumb starts with an id, then add it to the\n // map of initial entries, so that we can use it to match\n if (breadcrumb.first.name) {\n const initialSet =\n this.#initialEntries.get(breadcrumb.first.name) ?? new Set()\n initialSet.add(mod)\n this.#initialEntries.set(breadcrumb.first.name, initialSet)\n }\n }\n }\n\n /**\n * Try matching the provided node against the top-level selectors. In case\n * a match is found it will also register the active entry modifier and\n * update the active entry to the current importer node.\n */\n tryImporter(importer: Node) {\n for (const modifier of this.#modifiers) {\n // if the first item in the breadcrumb is an importer and it matches\n // any of the valid top-level selectors, then register the modifier\n const { first } = modifier.breadcrumb\n const matchRoot =\n first.value === ':root' && importer.mainImporter\n const matchWorkspace =\n first.value === ':workspace' && importer.importer\n const matchAny =\n first.value === ':project' || matchRoot || matchWorkspace\n if (first.importer && matchAny) {\n const active = this.newModifier(importer, modifier)\n const single = active.modifier.breadcrumb.single\n // only the importers will update the active entry right after\n // registering it since tryImporter doesn't try to match from\n // active dependencies\n if (!single) {\n this.updateActiveEntry(importer, active)\n }\n }\n }\n }\n\n /**\n * Try matching the provided node and spec to the current\n * active parsing modifier entries along with possible starting-level\n * modifiers.\n *\n * Any entries in which the breachcrumb have already reached its last\n * element will be prioritized, along with checking for specificity,\n * the complete entry with the highest specificity will be returned or just\n * the entry with the highest specificity if no complete entry is found.\n * Returns `undefined` if no matching entry is found.\n *\n * This method works with the assumption that it's going to be called\n * during a graph traversal, such that any ascendent has been checked\n * and the active modifier entry state has been updated in the previous\n * iteration.\n */\n tryNewDependency(\n from: Node,\n spec: Spec,\n ): ModifierActiveEntry | undefined {\n const { name, semver } = spec\n // here we use a map instead of a set so that we can associate each\n // modifier active entry with its breadcrumb so that it's easier to\n // pick the correct entry when we sort breadcrbumbs by specificity\n const all = new Map<\n ModifierBreadcrumb | undefined,\n ModifierActiveEntry\n >()\n for (const modifier of this.#modifiers) {\n // if an active entry is found then returns that\n const entry = this.#activeEntries\n .get(modifier)\n ?.get(name)\n ?.get(from)\n if (entry) {\n all.set(entry.modifier.breadcrumb, entry)\n }\n }\n // matches the name against the initial entries, this will make it so\n // that modifier queries that start with a name (e.g: #a > #b) can\n // match at any point of the graph traversal\n const initialSet =\n this.#initialEntries.get(name) ?? new Set<ModifierEntry>()\n for (const initial of initialSet) {\n const initialEntry =\n /* c8 ignore next - difficult to test branch */\n this.#activeEntries.get(initial)?.get(name)?.get(from) ??\n this.newModifier(from, initial)\n all.set(initialEntry.modifier.breadcrumb, initialEntry)\n }\n // selects the active entry that should apply to this dependency,\n // any active entry that is done parsing has the priority, if we\n // find multiple entries then we use css specificity to pick a winner\n // if we have multiple matches but no active entry is complete, then\n // we pick the one with the highest specificity breadcrumb\n const arr = [...all.values()]\n const completeEntries = arr.filter(\n active =>\n active.interactiveBreadcrumb.current ===\n active.modifier.breadcrumb.last,\n )\n // deregister completed entries\n for (const entry of completeEntries) {\n this.deregisterModifier(entry.modifier)\n }\n // returns the highest specificity entry from either the complete entries\n // if any were found or from any of the entries if available, otherwise\n // it will return undefined as no entry is found in the `all` map\n const entries = completeEntries.length ? completeEntries : arr\n return all.get(\n specificitySort(\n entries\n // here we filter out any entries that do not match the\n // pseudo selector comparators used in the breadcrumb item\n .filter(i =>\n i.interactiveBreadcrumb.current?.comparator({\n semver,\n }),\n )\n .map(i => i.modifier.breadcrumb),\n )[0],\n )\n }\n\n /**\n * Returns the set of {@link ModifierActiveEntry} instances that matches\n * the provided {@link Dependency} specs for a given node.\n *\n * This method is mostly a helper to {@link GraphModifier.tryNewDependency}\n * that handles the registered modifiers traversal lookup.\n */\n tryDependencies(\n from: Node,\n dependencies: Dependency[] | Edge[],\n ): Map<string, ModifierActiveEntry> {\n const modifierRefs = new Map<string, ModifierActiveEntry>()\n for (const { spec } of dependencies) {\n const active = this.tryNewDependency(from, spec)\n if (active) {\n modifierRefs.set(spec.name, active)\n }\n }\n return modifierRefs\n }\n\n /**\n * Updates an active entry state keeping track of items in the multi-level\n * active entries map. If the current breadcrumb state shows there's no more\n * items left, then we deregister the modifier.\n */\n updateActiveEntry(from: Node, active: ModifierActiveEntry): void {\n const { modifier } = active\n const interactiveBreadcrumb = active.interactiveBreadcrumb.next()\n const name = interactiveBreadcrumb.current?.name\n\n // if there's no name, or we're done parsing then we\n // deregister the modifier instead of updating the entry\n if (interactiveBreadcrumb.done || !name) {\n this.deregisterModifier(modifier)\n return\n }\n\n // register the active modifier\n this.activeModifiers.add(active)\n active.modifier.refs.add({ from, name })\n\n // optionally read or create the nested maps\n const nameMap =\n this.#activeEntries.get(modifier) ??\n new Map<string, Map<Node, ModifierActiveEntry>>()\n this.#activeEntries.set(modifier, nameMap)\n const nodeMap =\n nameMap.get(name) ?? new Map<Node, ModifierActiveEntry>()\n nameMap.set(name, nodeMap)\n\n // sets the active entry in the map\n nodeMap.set(from, active)\n }\n\n /**\n * Creates a new active modifier.\n */\n newModifier(\n from: Node,\n modifier: ModifierEntry,\n ): ModifierActiveEntry {\n return {\n modifier,\n interactiveBreadcrumb: modifier.breadcrumb.interactive(),\n originalFrom: from,\n }\n }\n\n /**\n * Removes a previously registered modifier from the active entries.\n */\n deregisterModifier(modifier: ModifierEntry): void {\n for (const { from, name } of modifier.refs) {\n const nodeMap = this.#activeEntries.get(modifier)?.get(name)\n if (nodeMap) {\n // if an entry is found, we remove it from the active set\n const entry = nodeMap.get(from)\n if (entry) {\n this.activeModifiers.delete(entry)\n }\n // then we remove the entry from the map\n nodeMap.delete(from)\n // if the map is empty, we remove it from the active entries map\n if (!nodeMap.size) {\n this.#activeEntries.get(modifier)?.delete(name)\n }\n }\n }\n }\n\n /**\n * Operates in previously registered nodes and edges in order to put\n * back in place any of the original edges that were referenced to in\n * active (ongoing) breadcrumb parsing entries that were never completed.\n *\n * This method can be used to easily rollback any pending operations\n * once the graph traversal is done.\n */\n rollbackActiveEntries(): void {\n for (const modifier of this.activeModifiers) {\n // if the modifier has an original edge, we can put it back in place\n if (modifier.originalEdge) {\n modifier.originalFrom.edgesOut.set(\n modifier.originalEdge.spec.name,\n modifier.originalEdge,\n )\n }\n // then we deregister the modifier\n this.deregisterModifier(modifier.modifier)\n }\n }\n\n /**\n * Convenience method to instantiate and load in one call.\n * Returns undefined if the project does not have a vlt.json file,\n * otherwise returns the loaded Modifiers instance.\n */\n static maybeLoad(options: SpecOptions) {\n const config = load('modifiers', assertRecordStringString)\n if (!config) return\n return new GraphModifier(options)\n }\n\n /**\n * Convenience method to instantiate and load in one call.\n * Throws if called on a directory that does not have a vlt.json file.\n */\n static load(options: SpecOptions) {\n return new GraphModifier(options)\n }\n}\n", "import { error } from '@vltpkg/error-cause'\nimport { satisfies } from '@vltpkg/satisfies'\nimport type {\n BuildIdealAddOptions,\n BuildIdealFromGraphOptions,\n} from './types.ts'\n\nexport type RemoveSatisfiedSpecsOptions = BuildIdealAddOptions &\n BuildIdealFromGraphOptions\n\n/**\n * Traverse the objects defined in `add` and removes any references to specs\n * that are already satisfied by the contents of the actual `graph`.\n */\nexport const removeSatisfiedSpecs = ({\n add,\n graph,\n}: RemoveSatisfiedSpecsOptions) => {\n for (const [depID, dependencies] of add.entries()) {\n const importer = graph.nodes.get(depID)\n if (!importer) {\n throw error('Referred importer node id could not be found', {\n found: depID,\n })\n }\n for (const [name, dependency] of dependencies) {\n const edge = importer.edgesOut.get(name)\n if (!edge) {\n // brand new edge being added\n continue\n }\n\n // If the current graph edge is already valid, then we remove that\n // dependency item from the list of items to be added to the graph\n if (\n satisfies(\n edge.to?.id,\n dependency.spec,\n edge.from.location,\n graph.projectRoot,\n graph.monorepo,\n )\n ) {\n dependencies.delete(name)\n }\n }\n }\n\n // Removes any references to an importer that no longer has specs\n for (const [depID, dependencies] of add.entries()) {\n if (dependencies.size === 0) {\n add.delete(depID)\n }\n }\n}\n", "import { longDependencyTypes } from '@vltpkg/types'\nimport { shorten, asDependency } from '../dependencies.ts'\nimport type {\n AddImportersDependenciesMap,\n Dependency,\n RemoveImportersDependenciesMap,\n} from '../dependencies.ts'\nimport { removeSatisfiedSpecs } from './remove-satisfied-specs.ts'\nimport type {\n BuildIdealAddOptions,\n BuildIdealFromGraphOptions,\n BuildIdealRemoveOptions,\n TransientAddMap,\n TransientRemoveMap,\n} from './types.ts'\nimport type { Edge } from '../edge.ts'\nimport type { Node } from '../node.ts'\nimport type { Graph } from '../graph.ts'\nimport type { DepID } from '@vltpkg/dep-id'\nimport { Spec } from '@vltpkg/spec'\nimport type { SpecOptions } from '@vltpkg/spec'\nimport type { PackageJson } from '@vltpkg/package-json'\nimport type { PathScurry } from 'path-scurry'\n\nexport type GetImporterSpecsOptions = BuildIdealAddOptions &\n BuildIdealFromGraphOptions &\n BuildIdealRemoveOptions &\n SpecOptions & {\n scurry: PathScurry\n packageJson: PackageJson\n }\n\nconst hasDepName = (importer: Node, edge: Edge): boolean => {\n for (const depType of longDependencyTypes) {\n const listedDeps = importer.manifest?.[depType]\n if (listedDeps && Object.hasOwn(listedDeps, edge.name))\n return true\n }\n return false\n}\n\nclass AddImportersDependenciesMapImpl\n extends Map\n implements AddImportersDependenciesMap\n{\n modifiedDependencies = false\n}\n\nclass RemoveImportersDependenciesMapImpl\n extends Map\n implements RemoveImportersDependenciesMap\n{\n modifiedDependencies = false\n}\n\n/**\n * Given a {@link Graph} and a list of {@link Dependency}, merges the\n * dependencies info found in the graph importers and returns the add & remove\n * results as a Map in which keys are {@link DepID} of each importer node.\n */\nexport const getImporterSpecs = (\n options: GetImporterSpecsOptions,\n) => {\n const { add, graph, remove } = options\n const addResult: AddImportersDependenciesMap =\n new AddImportersDependenciesMapImpl()\n const removeResult: RemoveImportersDependenciesMap =\n new RemoveImportersDependenciesMapImpl()\n\n // traverse the list of importers in the starting graph\n for (const importer of graph.importers) {\n // uses a Map keying to the spec.name in order to easily make sure there's\n // only a single dependency entry for a given dependency for each importer\n const addDeps = new Map<string, Dependency>()\n const removeDeps = new Set<string>()\n // if an edge from the graph is not listed in the manifest,\n // add that edge to the list of dependencies to be removed\n for (const edge of importer.edgesOut.values()) {\n if (\n !hasDepName(importer, edge) &&\n !add.get(importer.id)?.has(edge.name)\n ) {\n removeDeps.add(edge.name)\n removeResult.modifiedDependencies = true\n }\n }\n // if a dependency is listed in the manifest but not in the graph,\n // add that dependency to the list of dependencies to be added\n for (const depType of longDependencyTypes) {\n const deps = Object.entries(importer.manifest?.[depType] ?? {})\n for (const [depName, depSpec] of deps) {\n const edge = importer.edgesOut.get(depName)\n\n // skip if the edge exists and already uses the same spec\n if (edge?.to && depSpec === edge.spec.bareSpec) continue\n\n const dependency = asDependency({\n spec: Spec.parse(depName, depSpec, options),\n type: shorten(depType, depName, importer.manifest),\n })\n addDeps.set(depName, dependency)\n }\n }\n addResult.set(importer.id, addDeps)\n removeResult.set(importer.id, removeDeps)\n }\n\n // Maps to store dependencies targeting non-importer nodes (e.g., nested folders)\n // These will be injected when the target node is placed in the graph\n const transientAdd = new Map() as TransientAddMap\n const transientRemove = new Map() as TransientRemoveMap\n\n // Traverse all nodes in the graph to find file type dependencies that are directories\n // and populate transientAdd/transientRemove with their manifest dependencies\n // Only process when scurry and packageJson are available\n for (const node of graph.nodes.values()) {\n // Skip importers as they're already handled above and also skip\n // any non-file type dependencies\n if (graph.importers.has(node) || !node.id.startsWith('file'))\n continue\n\n // check if this is a file type dependency that is a directory\n const nodePath = options.scurry.cwd.resolve(node.location)\n const stat = nodePath.lstatSync()\n\n if (stat?.isDirectory()) {\n // load the manifest for this directory (throw if it does not exist)\n const manifest = options.packageJson.read(nodePath.fullpath())\n\n // should always set the manifest to the read manifest\n node.manifest = manifest\n\n // create a map of dependencies from the manifest\n const addDeps = new Map<string, Dependency>()\n\n // check for edges not in manifest (should be removed)\n const removeDeps = new Set<string>()\n for (const edge of node.edgesOut.values()) {\n if (\n !hasDepName(node, edge) &&\n !add.get(node.id)?.has(edge.name)\n ) {\n removeDeps.add(edge.name)\n }\n }\n\n // iterate over manifest dependencies to add them if\n // they're missing from the graph\n for (const depType of longDependencyTypes) {\n const deps = Object.entries(manifest[depType] ?? {})\n for (const [depName, depSpec] of deps) {\n const edge = node.edgesOut.get(depName)\n\n // skip if the edge exists and already uses the same spec\n if (edge?.to && depSpec === edge.spec.bareSpec) continue\n\n // add the dependency to the addDeps map\n const dependency = asDependency({\n spec: Spec.parse(depName, depSpec, options),\n type: shorten(depType, depName, manifest),\n })\n addDeps.set(depName, dependency)\n }\n }\n\n // store in transientAdd if there are any dependencies\n if (addDeps.size > 0) {\n transientAdd.set(node.id, addDeps)\n }\n\n // store in transientRemove if there are any to remove\n if (removeDeps.size > 0) {\n transientRemove.set(node.id, removeDeps)\n }\n }\n }\n\n // merges any provided specs to add to the current found results\n for (const [id, addDeps] of add.entries()) {\n const deps = addResult.get(id)\n if (!deps) {\n // Not an importer - only store file-type deps for later injection\n if (id.startsWith('file')) {\n transientAdd.set(id, addDeps)\n }\n continue\n }\n for (const [name, dep] of addDeps.entries()) {\n deps.set(name, dep)\n }\n }\n\n // Merges results from user-provided `remove` option with any remove\n // results found from comparing the manifest with the loaded graph\n for (const [key, removeSet] of remove) {\n const importerRemoveItem = removeResult.get(key)\n if (importerRemoveItem) {\n for (const depName of removeSet) {\n importerRemoveItem.add(depName)\n }\n } else if (key.startsWith('file')) {\n // Not an importer - only store file-type deps in transientRemove\n const existing = transientRemove.get(key)\n if (existing) {\n for (const depName of removeSet) {\n existing.add(depName)\n }\n } else {\n transientRemove.set(key, new Set(removeSet))\n }\n }\n }\n\n // Removes any references to an importer that no longer has specs\n for (const [key, removeItem] of removeResult) {\n if (removeItem.size === 0) {\n removeResult.delete(key)\n }\n }\n\n // removes already satisfied dependencies from the dependencies list\n removeSatisfiedSpecs({\n add: addResult,\n graph,\n })\n\n // set the modifiedDependencies flag if any\n // of the importers have modified dependencies\n for (const addDeps of addResult.values()) {\n if (addDeps.size > 0) {\n addResult.modifiedDependencies = true\n break\n }\n }\n\n return {\n add: addResult,\n remove: removeResult,\n transientAdd,\n transientRemove,\n }\n}\n", "import { Spec } from '@vltpkg/spec'\nimport type { Dependency } from './dependencies.ts'\nimport type { Manifest } from '@vltpkg/types'\nimport type { SpecOptions } from '@vltpkg/spec'\n\n/**\n * When adding new dependencies, it's very common to not have a dependency\n * name directly available to reference, e.g: `file:local/folder` or\n * `remote:tarball-url.tgz`. In these cases, a placeholder `(unknown)` name\n * is used in the `Spec` object and the `add` Map structure that holds\n * references to added dependencies will use the stringified spec as a key.\n *\n * This helper function fixes unknown names in the `add` map by replacing\n * placeholder specs with the correct names from the provided manifest.\n */\nexport const fixupAddedNames = (\n add: Map<string, Dependency> | undefined,\n manifest: Pick<Manifest, 'name'> | undefined,\n options: SpecOptions,\n spec: Spec,\n): Spec => {\n // Handle nameless dependencies\n if (add && manifest?.name && spec.name === '(unknown)') {\n const s: Dependency | undefined = add.get(String(spec))\n if (s) {\n // removes the previous, placeholder entry key\n add.delete(String(spec))\n // replaces spec with a version with the correct name\n spec = Spec.parse(manifest.name, spec.bareSpec, options)\n // updates the add map with the fixed up spec\n const n = {\n type: s.type,\n spec,\n }\n add.set(manifest.name, n)\n }\n }\n return spec\n}\n", "import { hydrate } from '@vltpkg/dep-id'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\nimport { platformCheck } from '@vltpkg/pick-manifest'\nimport type { RollbackRemove } from '@vltpkg/rollback-remove'\nimport type { SpecOptions } from '@vltpkg/spec'\nimport type { PathScurry } from 'path-scurry'\nimport type { Diff } from '../diff.ts'\nimport type { Node } from '../node.ts'\nimport { optionalFail } from './optional-fail.ts'\nimport { removeOptionalSubgraph } from '../remove-optional-subgraph.ts'\n\n/**\n * Result of the extraction operation.\n * Either the extracted package data or an error if extraction failed.\n */\nexport type ExtractResult =\n | {\n success: true\n node: Node\n }\n | {\n success: false\n node: Node\n error: unknown\n }\n\n/**\n * Returns a function that handles removing\n * a failed optional node from its graph.\n * Returns undefined for non-optional nodes when no diff is provided.\n */\nconst getOptionalFailedNodeRemover = (node: Node, diff?: Diff) => {\n return (\n diff ? optionalFail(diff, node)\n : node.isOptional() ?\n () => removeOptionalSubgraph(node.graph, node)\n : undefined\n )\n}\n\n/**\n * Extract a single node to the file system.\n * Returns a promise that resolves when the extraction is complete.\n */\nexport const extractNode = async (\n node: Node,\n scurry: PathScurry,\n remover: RollbackRemove,\n options: SpecOptions,\n packageInfo: PackageInfoClient,\n diff?: Diff,\n): Promise<ExtractResult> => {\n node.extracted = true\n const { manifest = {} } = node\n const target = node.resolvedLocation(scurry)\n const from = scurry.resolve('')\n const spec = hydrate(node.id, node.name, options)\n const removeOptionalFailedNode = getOptionalFailedNodeRemover(\n node,\n diff,\n )\n const { integrity, resolved } = node\n\n // Use platform data from node if available (from lockfile), otherwise fall back to manifest\n const platformData = node.platform ?? manifest\n\n // Check if we should skip this node due to platform incompatibility or deprecation\n if (\n removeOptionalFailedNode &&\n (manifest.deprecated ||\n !platformCheck(\n platformData,\n process.version,\n process.platform,\n process.arch,\n ))\n ) {\n removeOptionalFailedNode()\n return {\n success: false,\n node,\n error: new Error('Platform check failed or package deprecated'),\n }\n }\n\n try {\n await remover.rm(target)\n\n if (removeOptionalFailedNode) {\n try {\n const result = await packageInfo.extract(spec, target, {\n from,\n integrity,\n resolved,\n })\n // Store computed integrity for git/remote deps\n if (result.integrity && !node.integrity) {\n node.integrity = result.integrity\n }\n return { success: true, node }\n } catch (error) {\n removeOptionalFailedNode()\n return { success: false, node, error }\n }\n } else {\n const result = await packageInfo.extract(spec, target, {\n from,\n integrity,\n resolved,\n })\n // Store computed integrity for git/remote deps\n if (result.integrity && !node.integrity) {\n node.integrity = result.integrity\n }\n return { success: true, node }\n }\n } catch (error) {\n /* c8 ignore start */\n if (removeOptionalFailedNode) {\n removeOptionalFailedNode()\n return { success: false, node, error }\n }\n /* c8 ignore stop */\n throw error\n }\n}\n", "import type { Node } from '../node.ts'\nimport type { Dependency } from '../dependencies.ts'\nimport type {\n BuildIdealAddOptions,\n BuildIdealRemoveOptions,\n} from './types.ts'\n\n/**\n * Computes the ordered list of dependencies for an given node,\n * taking into account additions and removals.\n */\nexport const getNodeOrderedDependencies = (\n fromNode: Node,\n options?: BuildIdealAddOptions & BuildIdealRemoveOptions,\n): Dependency[] => {\n // using a map here instead of an array helps us get simpler\n // deduplication while iterating through all the items at hand:\n // existing dependencies in the graph, dependencies to be added, etc.\n const deps = new Map<string, Dependency>()\n for (const [name, { spec, type }] of fromNode.edgesOut.entries()) {\n deps.set(name, { spec, type })\n }\n // next iterate through the list of dependencies to be added\n const addedDeps = options?.add.get(fromNode.id)\n if (addedDeps) {\n for (const [name, { spec, type }] of addedDeps.entries()) {\n deps.set(name, { spec, type })\n }\n }\n // finally iterate through the list of dependencies to be removed\n const removedDeps = options?.remove.get(fromNode.id)\n if (removedDeps) {\n for (const name of removedDeps) {\n deps.delete(name)\n }\n }\n\n // now turn the map into a sorted array\n return getOrderedDependencies([...deps.values()])\n}\n\nexport const getOrderedDependencies = (\n deps: Dependency[],\n): Dependency[] => {\n const orderedDeps = [...deps].sort(\n ({ spec: aSpec, type: aType }, { spec: bSpec, type: bType }) => {\n const aIsPeer =\n aType === 'peer' || aType === 'peerOptional' ? 1 : 0\n const bIsPeer =\n bType === 'peer' || bType === 'peerOptional' ? 1 : 0\n\n // regular dependencies first, peer dependencies last\n if (aIsPeer !== bIsPeer) {\n return aIsPeer - bIsPeer\n }\n\n return aSpec.name.localeCompare(bSpec.name, 'en')\n },\n )\n return orderedDeps\n}\n", "// helpers for managing peer dependency resolution\n// during the ideal graph building process.\n\nimport { intersects } from '@vltpkg/semver'\nimport { satisfies } from '@vltpkg/satisfies'\nimport { getDependencies } from '../dependencies.ts'\nimport { getOrderedDependencies } from './get-ordered-dependencies.ts'\nimport type {\n ProcessPlacementResultEntry,\n PeerContext,\n PeerContextEntry,\n PeerContextEntryInput,\n ProcessPlacementResult,\n} from './types.ts'\nimport type { Spec, SpecOptions } from '@vltpkg/spec'\nimport type { DependencySaveType, Manifest } from '@vltpkg/types'\nimport type { Monorepo } from '@vltpkg/workspaces'\nimport type { Dependency } from '../dependencies.ts'\nimport type { Graph } from '../graph.ts'\nimport type { Node } from '../node.ts'\n\n/**\n * Retrieve a unique hash value for a given peer context set.\n */\nexport const retrievePeerContextHash = (\n peerContext: PeerContext | undefined,\n): string | undefined => {\n // skips creating the initial peer context ref\n if (!peerContext?.index) return undefined\n\n return `\u1E57:${peerContext.index}`\n}\n\n/**\n * Checks if a given spec is compatible with the specs already\n * assigned to a peer context entry.\n *\n * Returns true if compatible, false otherwise.\n */\nexport const incompatibleSpecs = (\n spec: Spec,\n entry: PeerContextEntry,\n): boolean => {\n if (entry.specs.size > 0) {\n for (const s of entry.specs) {\n if (\n // only able to check range intersections for registry types\n (spec.type === 'registry' &&\n (!spec.range ||\n !s.range ||\n !intersects(spec.range, s.range))) ||\n // also support types other than registry in case\n // they use the very same bareSpec value\n (spec.type !== 'registry' && spec.bareSpec !== s.bareSpec)\n ) {\n return true\n }\n }\n }\n return false\n}\n\n/**\n * Sort peer context entry inputs for deterministic processing.\n * Orders: non-peer dependencies first, then peer dependencies, alphabetically by name.\n */\nexport const getOrderedPeerContextEntries = (\n entries: PeerContextEntryInput[],\n): PeerContextEntryInput[] =>\n [...entries].sort((a, b) => {\n const aIsPeer =\n a.type === 'peer' || a.type === 'peerOptional' ? 1 : 0\n const bIsPeer =\n b.type === 'peer' || b.type === 'peerOptional' ? 1 : 0\n if (aIsPeer !== bIsPeer) return aIsPeer - bIsPeer\n const aName = a.target?.name ?? a.spec.name\n const bName = b.target?.name ?? b.spec.name\n return aName.localeCompare(bName, 'en')\n })\n\n/*\n * Checks if there are any conflicting versions for a given dependency\n * to be added to a peer context set which will require forking.\n *\n * Returns true if forking is needed, false otherwise.\n */\nexport const checkEntriesToPeerContext = (\n peerContext: PeerContext,\n entries: PeerContextEntryInput[],\n): boolean => {\n // check on compatibility of new entries\n for (const { spec, target } of entries) {\n const name = target?.name ?? spec.final.name\n\n // skip any inactive entry\n const entry = peerContext.get(name)\n if (!entry?.active) continue\n\n // validate if the provided spec is compatible with existing specs\n if (incompatibleSpecs(spec, entry)) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * Add or update dependencies in a given peer context making sure to check\n * for compatibility with existing dependencies already resolved by a given\n * peer context set. Extra info such as a target or dependent nodes is\n * optional.\n *\n * Returns true if forking is needed, false otherwise.\n */\nexport const addEntriesToPeerContext = (\n peerContext: PeerContext,\n entries: PeerContextEntryInput[],\n fromNode: Node,\n monorepo?: Monorepo,\n): boolean => {\n // pre check to see if any of the new entries to be added to the\n // provided peer context set conflicts with existing ones\n // if that's already the case we can skip processing them and\n // will return that a fork is needed right away\n if (checkEntriesToPeerContext(peerContext, entries)) return true\n\n // iterate on every entry to be added to the peer context set\n for (const { dependent, spec, target, type } of entries) {\n const name = target?.name ?? spec.final.name\n\n // if there's no existing entry, create one\n let entry = peerContext.get(name)\n if (!entry) {\n entry = {\n active: true,\n specs: new Set([spec]),\n target,\n type,\n contextDependents: new Set(),\n }\n peerContext.set(name, entry)\n if (dependent) entry.contextDependents.add(dependent)\n continue\n }\n\n // perform an extra check that confirms the new spec does not\n // conflicts with existing specs in this entry, this handles the\n // case of adding sibling deps that conflicts with one another\n if (incompatibleSpecs(spec, entry)) return true\n\n if (\n target &&\n [...entry.specs].every(s =>\n satisfies(\n target.id,\n s,\n fromNode.location,\n fromNode.projectRoot,\n monorepo,\n ),\n )\n ) {\n if (\n target.id !== entry.target?.id &&\n target.version !== entry.target?.version\n ) {\n // we have a compatible entry that has a new, compatible target\n // so we need to update all dependents to point to the new target\n for (const dependents of entry.contextDependents) {\n const edge = dependents.edgesOut.get(name)\n if (edge?.to && edge.to !== target) {\n edge.to.edgesIn.delete(edge)\n edge.to = target\n target.edgesIn.add(edge)\n }\n }\n entry.target = target\n }\n\n // otherwise sets the value in case it was nullish\n entry.target ??= target\n }\n\n // update specs and dependents values\n entry.specs.add(spec)\n if (dependent) entry.contextDependents.add(dependent)\n }\n\n return false\n}\n\n/**\n * Create and returns a forked copy of a given peer context set.\n */\nexport const forkPeerContext = (\n graph: Graph,\n peerContext: PeerContext,\n entries: PeerContextEntryInput[],\n): PeerContext => {\n // create a new peer context set\n const nextPeerContext: PeerContext = new Map()\n nextPeerContext.index = graph.nextPeerContextIndex()\n // register it in the graph\n graph.peerContexts[nextPeerContext.index] = nextPeerContext\n\n // copy existing entries marking them as inactive, it's also important\n // to note that specs and contextDependents are new objects so that changes\n // to those in the new context do not affect the previous one\n for (const [name, entry] of peerContext.entries()) {\n nextPeerContext.set(name, {\n active: false,\n specs: new Set(entry.specs),\n target: undefined,\n type: entry.type,\n contextDependents: new Set(entry.contextDependents),\n })\n }\n\n // add the new entries to this peer context set, marking them as active\n // these are the entries that were incompatible with the previous context set\n for (const entry of entries) {\n const { dependent, spec, target, type } = entry\n const name = target?.name /* c8 ignore next */ ?? spec.final.name\n const newEntry = {\n active: true,\n specs: new Set([spec]),\n target,\n type,\n contextDependents:\n dependent ? new Set([dependent]) : new Set<Node>(),\n }\n nextPeerContext.set(name, newEntry)\n }\n\n return nextPeerContext\n}\n\n/**\n * Starts the peer dependency placement process\n * for a given node being processed and placed.\n */\nexport const startPeerPlacement = (\n peerContext: PeerContext,\n manifest: Manifest,\n fromNode: Node,\n options: SpecOptions,\n) => {\n // queue entries so that they can be added at the end of the placement\n // process, use a map to ensure deduplication between read json dep\n // values and the resolved edges in the graph\n const queueMap = new Map<string, PeerContextEntryInput>()\n let peerSetHash: string | undefined\n\n if (\n manifest.peerDependencies &&\n Object.keys(manifest.peerDependencies).length > 0\n ) {\n // generates a peer context set hash for nodes that\n // have peer dependencies to be resolved\n peerSetHash = retrievePeerContextHash(peerContext)\n\n // get any potential sibling dependency from the\n // parent node that might have not been parsed yet\n const siblingDeps = getDependencies(fromNode, {\n ...options,\n registry: fromNode.registry,\n })\n for (const [depName, dep] of siblingDeps) {\n queueMap.set(depName, dep)\n }\n\n // collect the already parsed nodes and add those to the\n // list of entries to be added to the peer context set\n for (const edge of fromNode.edgesOut.values()) {\n queueMap.set(edge.name, {\n spec: edge.spec,\n target: edge.to,\n type: edge.type,\n })\n }\n }\n\n return {\n peerSetHash,\n // Sort queuedEntries for deterministic order\n queuedEntries: getOrderedPeerContextEntries([\n ...queueMap.values(),\n ]),\n }\n}\n\n/**\n * Ends the peer dependency placement process, returning the functions that\n * are going to be used to update the peer context set, forking when needed\n * and resolving peer dependencies if possible.\n */\nexport const endPeerPlacement = (\n peerContext: PeerContext,\n nextDeps: Dependency[],\n nextPeerDeps: Map<string, Dependency> & { id?: number },\n graph: Graph,\n spec: Spec,\n fromNode: Node,\n node: Node,\n type: DependencySaveType,\n queuedEntries: PeerContextEntryInput[],\n) => ({\n /**\n * Add the new entries to the current peer context set.\n */\n putEntries: () => {\n // keep track of whether we need to fork the current peer context set\n let needsToForkPeerContext = false\n // add queued entries from this node parents along\n // with a self-ref to the current peer context set\n const prevEntries = [\n ...queuedEntries,\n /* ref itself */ {\n spec,\n target: node,\n type,\n },\n ]\n addEntriesToPeerContext(\n peerContext,\n prevEntries,\n fromNode,\n graph.monorepo,\n )\n\n // add this node's direct dependencies next\n const nextEntries = [\n ...nextDeps.map(dep => ({ ...dep, dependent: node })),\n ...[...nextPeerDeps.values()].map(dep => ({\n ...dep,\n dependent: node,\n })),\n ]\n if (nextEntries.length > 0) {\n needsToForkPeerContext = addEntriesToPeerContext(\n peerContext,\n nextEntries,\n node,\n graph.monorepo,\n )\n }\n\n // returns all entries that need to be added to a forked\n // context or undefined if the current context was updated directly\n return needsToForkPeerContext ? nextEntries : undefined\n },\n\n /**\n * Try to resolve peer dependencies using already seen target\n * values from the current peer context set.\n */\n resolvePeerDeps: () => {\n // iterate on the set of peer dependencies of the current node\n // and try to resolve them from the existing peer context set,\n // when possible, add them as edges in the graph right away, if not,\n // then we move them back to the `nextDeps` list for processing\n // along with the rest of the regular dependencies\n for (const nextDep of nextPeerDeps.values()) {\n const { spec, type } = nextDep\n if (type === 'peer' || type === 'peerOptional') {\n // FIRST: Check if there's a sibling dependency from the parent\n // that specifies this same package. Sibling deps take priority\n // because they represent the workspace's direct dependency,\n // which should be preferred over versions from other workspaces\n // that may have been added to the peer context earlier.\n const siblingEntry = queuedEntries.find(\n e =>\n (e.target?.name ?? e.spec.final.name) === spec.final.name,\n )\n\n if (\n siblingEntry?.target &&\n !node.edgesOut.has(spec.final.name) &&\n satisfies(\n siblingEntry.target.id,\n spec,\n fromNode.location,\n fromNode.projectRoot,\n graph.monorepo,\n )\n ) {\n // The sibling's resolved target satisfies the peer spec,\n // use it directly - this prioritizes the workspace's own\n // direct dependency over versions from other workspaces\n graph.addEdge(type, spec, node, siblingEntry.target)\n continue\n }\n\n // THEN: Try to retrieve an entry for that peer dep from\n // the current peer context set\n const entry = peerContext.get(spec.final.name)\n if (\n !node.edgesOut.has(spec.final.name) &&\n entry?.target &&\n satisfies(\n entry.target.id,\n spec,\n fromNode.location,\n fromNode.projectRoot,\n graph.monorepo,\n )\n ) {\n // entry satisfied, create edge in the graph\n graph.addEdge(type, spec, node, entry.target)\n entry.specs.add(spec.final)\n } else if (type === 'peerOptional') {\n // skip unsatisfied peerOptional dependencies,\n // just create a dangling edge\n graph.addEdge(type, spec, node)\n } else if (\n siblingEntry &&\n siblingEntry.spec.bareSpec !== spec.bareSpec\n ) {\n // Sibling has a more specific spec for this package,\n // use it when resolving to ensure we get the right version\n nextDeps.push({ ...nextDep, spec: siblingEntry.spec })\n } else {\n // could not satisfy from peer context or sibling, add to next deps\n nextDeps.push(nextDep)\n }\n }\n }\n },\n})\n\n/**\n * Given an array of processed results for the current level dependencies\n * being placed in the currently building ideal graph, traverse its direct\n * dependencies and track peer dependencies in their appropriate peer context\n * sets, forking as needed and resolving peer dependencies using suitable\n * nodes already present in the graph if possible.\n */\nexport const postPlacementPeerCheck = (\n graph: Graph,\n sortedLevelResults: ProcessPlacementResult[],\n) => {\n // Update peer contexts in a sorted manner after processing all nodes\n // at a given level to ensure deterministic behavior when it comes to\n // forking new peer contexts\n for (const childDepsToProcess of sortedLevelResults) {\n // Sort childDepsToProcess deterministically by node.id\n const sortedChildDeps = [...childDepsToProcess].sort((a, b) =>\n a.node.id.localeCompare(b.node.id, 'en'),\n )\n\n const needsForking = new Map<\n ProcessPlacementResultEntry,\n {\n dependent: Node\n spec: Spec\n type: DependencySaveType\n }[]\n >()\n // first iterate on all child deps, adding entries to the current\n // context and collect the information on which ones need forking\n for (const childDep of sortedChildDeps) {\n const needsFork = childDep.updateContext.putEntries()\n if (needsFork) {\n needsForking.set(childDep, needsFork)\n }\n }\n\n // Sort needsForking entries before iterating (Map iteration order = insertion order)\n const sortedNeedsForkingEntries = [\n ...needsForking.entries(),\n ].sort(([a], [b]) => a.node.id.localeCompare(b.node.id, 'en'))\n\n // then iterate again, forking contexts as needed but also try to\n // reuse the context of the previous sibling if possible\n let prevContext\n for (const [childDep, nextEntries] of sortedNeedsForkingEntries) {\n if (\n prevContext &&\n !checkEntriesToPeerContext(prevContext, nextEntries)\n ) {\n // the context of the previous sibling can be reused\n addEntriesToPeerContext(\n prevContext,\n nextEntries,\n childDep.node,\n graph.monorepo,\n )\n childDep.peerContext = prevContext\n continue\n }\n childDep.peerContext = forkPeerContext(\n graph,\n childDep.peerContext,\n nextEntries,\n )\n prevContext = childDep.peerContext\n }\n // try to resolve peer dependencies now that\n // the context is fully set up\n for (const childDep of sortedChildDeps) {\n childDep.updateContext.resolvePeerDeps()\n childDep.deps = getOrderedDependencies(childDep.deps)\n }\n }\n}\n", "import { joinDepIDTuple, joinExtra } from '@vltpkg/dep-id'\nimport type { DepID } from '@vltpkg/dep-id'\nimport { error } from '@vltpkg/error-cause'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\nimport { Spec } from '@vltpkg/spec'\nimport type { SpecOptions } from '@vltpkg/spec'\nimport { longDependencyTypes, normalizeManifest } from '@vltpkg/types'\nimport type {\n DependencyTypeLong,\n DependencySaveType,\n Manifest,\n} from '@vltpkg/types'\nimport type { PathScurry } from 'path-scurry'\nimport { fixupAddedNames } from '../fixup-added-names.ts'\nimport { shorten } from '../dependencies.ts'\nimport type { Dependency } from '../dependencies.ts'\nimport type { Graph } from '../graph.ts'\nimport type { Node } from '../node.ts'\nimport { removeOptionalSubgraph } from '../remove-optional-subgraph.ts'\nimport type {\n GraphModifier,\n ModifierActiveEntry,\n} from '../modifiers.ts'\nimport type { ExtractResult } from '../reify/extract-node.ts'\nimport { extractNode } from '../reify/extract-node.ts'\nimport type { RollbackRemove } from '@vltpkg/rollback-remove'\nimport {\n endPeerPlacement,\n postPlacementPeerCheck,\n startPeerPlacement,\n} from './peers.ts'\nimport type {\n PeerContext,\n AppendNodeEntry,\n ProcessPlacementResult,\n TransientAddMap,\n TransientRemoveMap,\n} from './types.ts'\n\ntype FileTypeInfo = {\n id: DepID\n path: string\n isDirectory: boolean\n}\n\n/**\n * Only install devDeps for git dependencies and importers\n * Everything else always gets installed\n */\nconst shouldInstallDepType = (\n node: Node,\n depType: DependencyTypeLong,\n) =>\n depType !== 'devDependencies' ||\n node.importer ||\n node.id.startsWith('git')\n\n/**\n * Retrieve the {@link DepID} and location for a `file:` type {@link Node}.\n */\nconst getFileTypeInfo = (\n spec: Spec,\n fromNode: Node,\n scurry: PathScurry,\n): FileTypeInfo | undefined => {\n const f = spec.final\n if (f.type !== 'file') return\n\n /* c8 ignore start - should be impossible */\n if (!f.file) {\n throw error('no path on file specifier', { spec })\n }\n /* c8 ignore stop */\n\n // Given that both linked folders and local tarballs (both defined with\n // usage of the `file:` spec prefix) location needs to be relative to their\n // parents, build the expected path and use it for both location and id\n const target = scurry.cwd.resolve(fromNode.location).resolve(f.file)\n const path = target.relativePosix()\n const id = joinDepIDTuple(['file', path])\n\n return {\n path,\n id,\n isDirectory: !!target.lstatSync()?.isDirectory(),\n }\n}\n\nconst isStringArray = (a: unknown): a is string[] =>\n Array.isArray(a) && !a.some(b => typeof b !== 'string')\n\n/**\n * Represents a manifest fetch operation with all the context needed.\n */\ntype ManifestFetchTask = {\n spec: Spec\n type: DependencySaveType\n fromNode: Node\n fileTypeInfo?: FileTypeInfo\n activeModifier?: ModifierActiveEntry\n queryModifier?: string\n edgeOptional: boolean\n manifestPromise: Promise<Manifest | undefined>\n depth: number\n peerContext: PeerContext\n}\n\n/**\n * Represents a node placement operation that depends on a resolved manifest.\n */\ntype NodePlacementTask = {\n fetchTask: ManifestFetchTask\n manifest: Manifest | undefined\n node?: Node\n childDeps?: Dependency[]\n childModifierRefs?: Map<string, ModifierActiveEntry>\n childPeerContext?: PeerContext\n}\n\n/**\n * Fetch manifests for dependencies and create placement tasks.\n */\nconst fetchManifestsForDeps = async (\n packageInfo: PackageInfoClient,\n graph: Graph,\n fromNode: Node,\n deps: Dependency[],\n scurry: PathScurry,\n peerContext: PeerContext,\n modifierRefs?: Map<string, ModifierActiveEntry>,\n depth = 0,\n): Promise<NodePlacementTask[]> => {\n // Create fetch tasks for all dependencies at this level\n const fetchTasks: ManifestFetchTask[] = []\n const placementTasks: NodePlacementTask[] = []\n\n for (const { spec: originalSpec, type } of deps) {\n let spec = originalSpec\n const fileTypeInfo = getFileTypeInfo(spec, fromNode, scurry)\n const activeModifier = modifierRefs?.get(spec.name)\n\n // here is the place we swap specs if a edge modifier was defined\n const queryModifier = activeModifier?.modifier.query\n const completeModifier =\n activeModifier &&\n activeModifier.interactiveBreadcrumb.current ===\n activeModifier.modifier.breadcrumb.last\n if (\n queryModifier &&\n completeModifier &&\n 'spec' in activeModifier.modifier\n ) {\n spec = activeModifier.modifier.spec\n if (spec.bareSpec === '-') {\n continue\n }\n }\n\n const peer = type === 'peer' || type === 'peerOptional'\n\n // skip reusing nodes for peer deps since their reusability\n // is handled ahead-of-time during its parent's placement\n const existingNode = graph.findResolution(\n spec,\n fromNode,\n queryModifier,\n )\n // defines what nodes are eligible to be reused\n const validExistingNode =\n existingNode &&\n !existingNode.detached &&\n // Regular deps can always reuse\n /* c8 ignore start */\n (!peer ||\n // otherwise reusing peer deps only in case of a peerSetHash matche\n existingNode.peerSetHash === fromNode.peerSetHash)\n /* c8 ignore stop */\n\n if (\n validExistingNode ||\n // importers are handled at the ./add-nodes.ts top-level\n // so we should just skip whenever we find one\n existingNode?.importer\n ) {\n graph.addEdge(type, spec, fromNode, existingNode)\n continue\n }\n\n // is the current edge pointint go an optional dependency?\n const edgeOptional =\n type === 'optional' || type === 'peerOptional'\n\n // Start manifest fetch immediately for parallel processing\n const manifestPromise =\n // the \"detached\" node state means that it has already been load as\n // part of a graph (either lockfile or actual) and it has valid manifest\n // data so we shortcut the package info manifest fetch here\n existingNode?.detached ?\n Promise.resolve(existingNode.manifest as Manifest | undefined)\n // this is the entry point to fetch calls to retrieve manifests\n // from the build ideal graph point of view\n : packageInfo\n .manifest(spec, { from: scurry.resolve(fromNode.location) })\n .then(manifest => manifest as Manifest | undefined)\n .catch((er: unknown) => {\n // optional deps ignored if inaccessible\n if (edgeOptional || fromNode.optional) {\n return undefined\n }\n throw er\n })\n\n const fetchTask: ManifestFetchTask = {\n spec,\n type,\n fromNode,\n fileTypeInfo,\n activeModifier,\n queryModifier,\n edgeOptional,\n manifestPromise,\n depth,\n peerContext,\n }\n\n fetchTasks.push(fetchTask)\n }\n\n // Create placement tasks from fetch tasks\n for (const fetchTask of fetchTasks) {\n const manifest = await fetchTask.manifestPromise\n\n placementTasks.push({\n fetchTask,\n manifest,\n })\n }\n\n // sort placement tasks: non-peer dependencies first, then peer dependencies\n // so that peer dependencies can easily reuse already placed regular\n // dependencies as part of peer context set resolution also makes sure to\n // sort by the manifest name for deterministic order.\n placementTasks.sort((a, b) => {\n const aIsPeer =\n (\n a.manifest?.peerDependencies &&\n Object.keys(a.manifest.peerDependencies).length > 0\n ) ?\n 1\n : 0\n const bIsPeer =\n (\n b.manifest?.peerDependencies &&\n Object.keys(b.manifest.peerDependencies).length > 0\n ) ?\n 1\n : 0\n\n // regular dependencies first, peer dependencies last\n if (aIsPeer !== bIsPeer) {\n return aIsPeer - bIsPeer\n }\n\n // if both are in the same group,\n // sort alphabetically by manifest name (fallback to spec.name)\n const aName =\n a.manifest?.name /* c8 ignore next */ || a.fetchTask.spec.name\n const bName = b.manifest?.name || b.fetchTask.spec.name\n return aName.localeCompare(bName, 'en')\n })\n\n return placementTasks\n}\n\n/**\n * Process placement tasks and collect child dependencies, this is the\n * second step of the appendNodes operation after manifest fetching in\n * which the final graph data structure is actually built.\n */\nconst processPlacementTasks = async (\n graph: Graph,\n options: SpecOptions,\n placementTasks: NodePlacementTask[],\n add?: Map<string, Dependency>,\n modifiers?: GraphModifier,\n scurry?: PathScurry,\n packageInfo?: PackageInfoClient,\n extractPromises?: Promise<ExtractResult>[],\n actual?: Graph,\n seenExtracted?: Set<DepID>,\n remover?: RollbackRemove,\n transientAdd?: TransientAddMap,\n transientRemove?: TransientRemoveMap,\n): Promise<ProcessPlacementResult> => {\n const childDepsToProcess: ProcessPlacementResult = []\n\n for (const placementTask of placementTasks) {\n const { fetchTask, manifest } = placementTask\n let {\n activeModifier,\n edgeOptional,\n fileTypeInfo,\n fromNode,\n peerContext,\n queryModifier,\n spec,\n type,\n } = fetchTask\n\n // fix the name in the `add` map when needed. This allows the upcoming\n // reify step to properly update the package.json file dependencies\n // using the correct names retrieved from the manifest data\n const additiveMap =\n fromNode.importer ? add : transientAdd?.get(fromNode.id)\n spec = fixupAddedNames(additiveMap, manifest, options, spec)\n\n // handles missing manifest resolution\n if (!manifest) {\n if (!edgeOptional && fromNode.isOptional()) {\n // failed resolution of a non-optional dep of an optional node\n // have to clean up the dependents\n removeOptionalSubgraph(graph, fromNode)\n continue\n } else if (edgeOptional) {\n // failed resolution of an optional dep, just ignore it,\n // nothing to prune because we never added it in the first place.\n continue\n } else {\n throw error('failed to resolve dependency', {\n spec,\n from: fromNode.location,\n })\n }\n }\n\n // start peer deps placement process, populating the peer context with\n // dependency data; adding the parent node deps and this manifest's\n // peer deps references to the current peer context set\n const peerPlacement = startPeerPlacement(\n peerContext,\n manifest,\n fromNode,\n options,\n )\n const peerSetHash = peerPlacement.peerSetHash\n const queuedEntries = peerPlacement.queuedEntries\n\n // places a new node in the graph representing a newly seen dependency\n const node = graph.placePackage(\n fromNode,\n type,\n spec,\n normalizeManifest(manifest),\n fileTypeInfo?.id,\n joinExtra({ peerSetHash, modifier: queryModifier }),\n )\n\n /* c8 ignore start - not possible, already ensured manifest */\n if (!node) {\n throw error('failed to place package', {\n from: fromNode.location,\n spec,\n })\n }\n /* c8 ignore stop */\n\n // update the node modifier tracker\n if (activeModifier) {\n modifiers?.updateActiveEntry(node, activeModifier)\n }\n\n const eligibleForExtraction =\n type !== 'peer' &&\n type !== 'peerOptional' &&\n remover &&\n extractPromises &&\n actual &&\n scurry &&\n packageInfo &&\n node.inVltStore() &&\n !node.isOptional() &&\n // this fixes an issue with installing `file:pathname` specs\n /* c8 ignore next */ !fileTypeInfo?.isDirectory &&\n !node.importer\n\n // extract the node if it meets the criteria for early extraction\n if (eligibleForExtraction) {\n /* c8 ignore start */\n if (seenExtracted?.has(node.id)) {\n continue\n }\n /* c8 ignore stop */\n seenExtracted?.add(node.id)\n const actualNode = actual.nodes.get(node.id)\n if (!actualNode?.equals(node)) {\n // extract the node without awaiting - push the promise to the array\n const extractPromise = extractNode(\n node,\n scurry,\n remover,\n options,\n packageInfo,\n )\n extractPromises.push(extractPromise)\n }\n }\n\n // updates graph node information\n if (fileTypeInfo?.path && fileTypeInfo.isDirectory) {\n node.location = fileTypeInfo.path\n }\n node.setResolved()\n\n // collect child dependencies for processing in the next level\n const nextPeerDeps = new Map<string, Dependency>()\n\n // compute deps normally\n const bundleDeps = manifest.bundleDependencies\n const bundled = new Set<string>(\n (\n node.id.startsWith('git') ||\n node.importer ||\n !isStringArray(bundleDeps)\n ) ?\n []\n : bundleDeps,\n )\n\n // setup next level to process all child dependencies in the manifest\n const nextDeps: Dependency[] = []\n\n // traverse actual dependency declarations in the manifest\n // creating dependency entries for them\n for (const depTypeName of longDependencyTypes) {\n const depRecord: Record<string, string> | undefined =\n manifest[depTypeName]\n\n if (depRecord && shouldInstallDepType(node, depTypeName)) {\n // Sort Object.entries for deterministic iteration\n const sortedEntries = Object.entries(depRecord).sort(\n ([a], [b]) => a.localeCompare(b, 'en'),\n )\n for (const [name, bareSpec] of sortedEntries) {\n // might need to skip already placed peer deps here\n if (bundled.has(name)) continue\n const dep = {\n type: shorten(depTypeName, name, manifest),\n spec: Spec.parse(name, bareSpec, {\n ...options,\n registry: spec.registry,\n }),\n }\n if (depTypeName === 'peerDependencies') {\n nextPeerDeps.set(name, dep)\n } else {\n nextDeps.push(dep)\n }\n }\n }\n }\n\n // Inject transient dependencies for non-importer nodes (nested folders)\n // These are deps that were added from a nested folder context using\n // relative file: specs that should resolve relative to that folder\n const transientDeps = transientAdd?.get(node.id)\n if (transientDeps) {\n for (const [, dep] of transientDeps) {\n if (dep.type === 'peer' || dep.type === 'peerOptional') {\n nextPeerDeps.set(dep.spec.name, dep)\n continue\n }\n\n // remove the dependency from nextDeps if it already exists\n const index = nextDeps.findIndex(\n d => d.spec.name === dep.spec.name,\n )\n if (index !== -1) {\n nextDeps.splice(index, 1)\n }\n\n nextDeps.push(dep)\n }\n }\n\n // Remove transient removals when needed\n const transientRemovals = transientRemove?.get(node.id)\n if (transientRemovals) {\n for (const depName of transientRemovals) {\n const index = nextDeps.findIndex(\n dep => dep.spec.name === depName,\n )\n if (index !== -1) {\n nextDeps.splice(index, 1)\n continue\n }\n\n if (nextPeerDeps.has(depName)) {\n nextPeerDeps.delete(depName)\n }\n }\n }\n\n // finish peer placement for this node, resolving satisfied peers\n // to seen nodes from the peer context and adding unsatisfied peers\n // to `nextDeps` so they get processed along regular dependencies\n const updateContext = endPeerPlacement(\n peerContext,\n nextDeps,\n nextPeerDeps,\n graph,\n spec,\n fromNode,\n node,\n type,\n queuedEntries,\n )\n\n childDepsToProcess.push({\n node,\n deps: nextDeps,\n modifierRefs: modifiers?.tryDependencies(node, nextDeps),\n peerContext,\n updateContext,\n })\n }\n\n return childDepsToProcess\n}\n\n/**\n * Append new nodes in the given `graph` for dependencies specified at `add`\n * and missing dependencies from the `deps` parameter.\n *\n * It also applies any modifiers that applies to a given node as it processes\n * and builds the graph.\n */\nexport const appendNodes = async (\n packageInfo: PackageInfoClient,\n graph: Graph,\n fromNode: Node,\n deps: Dependency[],\n scurry: PathScurry,\n options: SpecOptions,\n seen: Set<DepID>,\n add?: Map<string, Dependency>,\n modifiers?: GraphModifier,\n modifierRefs?: Map<string, ModifierActiveEntry>,\n extractPromises?: Promise<ExtractResult>[],\n actual?: Graph,\n seenExtracted?: Set<DepID>,\n remover?: RollbackRemove,\n transientAdd?: TransientAddMap,\n transientRemove?: TransientRemoveMap,\n) => {\n /* c8 ignore next */\n if (seen.has(fromNode.id)) return\n seen.add(fromNode.id)\n\n // Get the initial peer context from the graph\n const [initialPeerContext] = graph.peerContexts\n /* c8 ignore start - impossible */\n if (!initialPeerContext) {\n throw error('no initial peer context found in graph')\n }\n /* c8 ignore stop */\n\n // Use a queue for breadth-first processing\n let currentLevelDeps: AppendNodeEntry[] = [\n {\n node: fromNode,\n deps,\n modifierRefs,\n depth: 0,\n peerContext: initialPeerContext,\n /* c8 ignore start */\n updateContext: {\n putEntries: () => undefined,\n resolvePeerDeps: () => {},\n },\n /* c8 ignore stop */\n },\n ]\n\n while (currentLevelDeps.length > 0) {\n const nextLevelDeps: AppendNodeEntry[] = []\n\n // Process all nodes at the current level in parallel\n const levelResults = await Promise.all(\n currentLevelDeps.map(\n async ({\n node,\n deps: nodeDeps,\n modifierRefs: nodeModifierRefs,\n peerContext,\n depth,\n }: AppendNodeEntry) => {\n // Mark node as seen when we start processing its dependencies\n seen.add(node.id)\n\n // Fetch manifests for this node's dependencies\n const placementTasks = await fetchManifestsForDeps(\n packageInfo,\n graph,\n node,\n // Sort dependencies by spec.name for deterministic ordering\n nodeDeps.sort((a, b) =>\n a.spec.name.localeCompare(b.spec.name, 'en'),\n ),\n scurry,\n peerContext,\n nodeModifierRefs,\n depth,\n )\n\n // Process the placement tasks and get child dependencies\n return await processPlacementTasks(\n graph,\n options,\n placementTasks,\n add,\n modifiers,\n scurry,\n packageInfo,\n extractPromises,\n actual,\n seenExtracted,\n remover,\n transientAdd,\n transientRemove,\n )\n },\n ),\n )\n\n // Traverse the queued up children dependencies, adding and tracking\n // dependencies on the peer context set, forking the context as needed\n // and resolving any peer dependency that is able to be resolved using\n // the current peer context set\n postPlacementPeerCheck(graph, levelResults)\n\n // Collect all child dependencies for the next level\n for (const childDepsToProcess of levelResults) {\n for (const childDep of childDepsToProcess) {\n if (!seen.has(childDep.node.id)) {\n /* c8 ignore next */\n const currentDepth = currentLevelDeps[0]?.depth ?? 0\n nextLevelDeps.push({\n ...childDep,\n depth: currentDepth + 1,\n })\n }\n }\n }\n\n // Move to the next level\n currentLevelDeps = nextLevelDeps\n }\n}\n", "import { appendNodes } from './append-nodes.ts'\nimport { getNodeOrderedDependencies } from './get-ordered-dependencies.ts'\nimport type { PathScurry } from 'path-scurry'\nimport type { DepID } from '@vltpkg/dep-id'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { SpecOptions } from '@vltpkg/spec'\nimport type { RollbackRemove } from '@vltpkg/rollback-remove'\nimport type {\n BuildIdealAddOptions,\n BuildIdealFromGraphOptions,\n BuildIdealRemoveOptions,\n TransientAddMap,\n TransientRemoveMap,\n} from './types.ts'\nimport type { Dependency } from '../dependencies.ts'\nimport type { GraphModifier } from '../modifiers.ts'\nimport type { ExtractResult } from '../reify/extract-node.ts'\nimport type { Graph } from '../graph.ts'\nimport type { Node } from '../node.ts'\n\nexport type RefreshIdealGraphOptions = BuildIdealAddOptions &\n BuildIdealRemoveOptions &\n BuildIdealFromGraphOptions &\n SpecOptions & {\n /**\n * The graph modifiers helper object.\n */\n modifiers?: GraphModifier\n /**\n * A {@link PathScurry} instance based on the `projectRoot` path\n */\n scurry: PathScurry\n\n /**\n * A {@link PackageInfoClient} instance to read manifest info from.\n */\n packageInfo: PackageInfoClient\n\n /**\n * The actual graph to compare against for early extraction\n */\n actual?: Graph\n\n /**\n * A {@link RollbackRemove} instance to handle extraction rollbacks\n */\n remover: RollbackRemove\n\n /**\n * Dependencies to be added to non-importer nodes when they are placed.\n * Used for nested folder dependencies that are not importers.\n */\n transientAdd?: TransientAddMap\n\n /**\n * Dependencies to be removed from non-importer nodes when they are placed.\n * Used for nested folder dependencies that are not importers.\n */\n transientRemove?: TransientRemoveMap\n }\n\n/**\n * Returns an ordered list of importer nodes.\n */\nconst getOrderedImporters = (graph: Graph): Node[] => {\n const orderedImporters = [...graph.importers].sort((a, b) => {\n // sorts importers first by usage of peer deps\n const aIsPeer =\n (\n a.manifest?.peerDependencies &&\n Object.keys(a.manifest.peerDependencies).length > 0\n ) ?\n 1\n : 0\n const bIsPeer =\n (\n b.manifest?.peerDependencies &&\n Object.keys(b.manifest.peerDependencies).length > 0\n ) ?\n 1\n : 0\n\n // importers with regular deps only first, with peer deps last\n if (aIsPeer !== bIsPeer) {\n return aIsPeer - bIsPeer\n }\n\n // if both are in the same group, sort alphabetically by manifest name\n return a.name.localeCompare(b.name, 'en')\n })\n return orderedImporters\n}\n\n/**\n * Rebuilds the provided ideal graph.\n */\nexport const refreshIdealGraph = async ({\n add,\n graph,\n modifiers,\n packageInfo,\n scurry,\n actual,\n remove,\n remover,\n transientAdd,\n transientRemove,\n ...specOptions\n}: RefreshIdealGraphOptions) => {\n const seen = new Set<DepID>()\n const extractPromises: Promise<ExtractResult>[] = []\n const seenExtracted = new Set<DepID>()\n\n // gets an ordered list of importers to ensure deterministic processing\n const orderedImporters = getOrderedImporters(graph)\n const depsPerImporter = new Map<Node, Dependency[]>()\n for (const importer of orderedImporters) {\n // gets an ordered list of dependencies for this importer\n // while also taking into account additions and removals\n const deps = getNodeOrderedDependencies(importer, { add, remove })\n depsPerImporter.set(importer, deps)\n }\n\n // removes all edges to start recalculating the graph\n if (add.modifiedDependencies || remove.modifiedDependencies) {\n graph.resetEdges()\n }\n\n // iterates on the list of dependencies per importer updating\n // the graph using metadata fetch from the registry manifest files\n for (const importer of orderedImporters) {\n modifiers?.tryImporter(importer)\n\n // gets a ref to the map of dependencies being added to this importer\n const addedDeps = add.get(importer.id)\n\n const deps = depsPerImporter.get(importer)\n /* c8 ignore next */\n if (!deps) continue\n\n // gets a ref to the list of modifier functions for this set of deps\n const modifierRefs = modifiers?.tryDependencies(importer, deps)\n\n // Add new nodes for packages defined in the dependencies list fetching\n // metadata from the registry manifests and updating the graph\n await appendNodes(\n packageInfo,\n graph,\n importer,\n deps,\n scurry,\n specOptions,\n seen,\n addedDeps,\n modifiers,\n modifierRefs,\n extractPromises,\n actual,\n seenExtracted,\n remover,\n transientAdd,\n transientRemove,\n )\n }\n\n // set default node locations, if possible\n for (const node of graph.nodes.values()) {\n node.setDefaultLocation()\n }\n\n // Wait for all extraction promises to complete\n if (extractPromises.length > 0) {\n await Promise.all(extractPromises)\n }\n}\n\n/**\n * Global index to assign unique ids used to track peer context sets.\n */\nlet peerContextIndex = 0\n/**\n * Retrieve the next unique index for a peer context set.\n */\nexport const nextPeerContextIndex = () => peerContextIndex++\n", "import { getImporterSpecs } from './get-importer-specs.ts'\nimport { refreshIdealGraph } from './refresh-ideal-graph.ts'\nimport { resolveSaveType } from '../resolve-save-type.ts'\nimport type { PackageJson } from '@vltpkg/package-json'\nimport type { RefreshIdealGraphOptions } from './refresh-ideal-graph.ts'\nimport type { Graph } from '../graph.ts'\n\nexport type BuildIdealFromStartingGraphOptions =\n RefreshIdealGraphOptions & {\n packageJson: PackageJson\n }\n\n/**\n * Builds an ideal {@link Graph} representing the dependencies that\n * should be present in order to fulfill the requirements defined\n * by the `package.json` and `vlt-lock.json` files using the `graph` set\n * in options as a starting point. Also add / remove any dependencies\n * listed in the `add` and `remove` properties.\n */\nexport const buildIdealFromStartingGraph = async (\n options: BuildIdealFromStartingGraphOptions,\n): Promise<Graph> => {\n // Gets a map of dependencies that are keyed to its importer node ids,\n // merging values already found in the graph with user specified values.\n // Any dependencies that are already satisfied in the starting `graph`\n // are going to be pruned from the resulting object.\n const importerSpecs = getImporterSpecs(options)\n\n // merge modifiedDependencies flags\n options.add.modifiedDependencies =\n options.add.modifiedDependencies ||\n importerSpecs.add.modifiedDependencies\n options.remove.modifiedDependencies =\n options.remove.modifiedDependencies ||\n importerSpecs.remove.modifiedDependencies\n\n // merge values found on node specs with\n // user-provided values from `options.add`\n for (const [nodeId, deps] of importerSpecs.add) {\n const node = options.graph.nodes.get(nodeId)\n /* c8 ignore next - impossible */\n if (!node) continue\n\n if (!options.add.has(nodeId)) {\n options.add.set(nodeId, deps)\n continue\n }\n\n // merge any deps found when reading the nodes manifest\n // with the ones provided by the user in the `add` options,\n // user-provided deps should take precedence\n for (const [depName, dep] of deps) {\n if (!options.add.get(nodeId)?.has(depName)) {\n options.add.get(nodeId)?.set(depName, dep)\n }\n\n // update the save type for deps when using an implicit type\n dep.type = resolveSaveType(node, depName, dep.type)\n }\n }\n\n // merge values found on node specs with\n // user-provided values from `options.remove`\n for (const [nodeId, deps] of importerSpecs.remove) {\n if (!options.remove.has(nodeId)) {\n options.remove.set(nodeId, deps)\n continue\n }\n\n // merge any deps found when reading the nodes manifest\n // with the ones provided by the user in the `remove` options\n for (const depName of deps) {\n options.remove.get(nodeId)?.add(depName)\n }\n }\n\n // refreshs the current graph adding the nodes marked for addition\n // and removing the ones marked for removal, while also recalculating\n // peer dependencies and default locations\n await refreshIdealGraph({\n ...options,\n transientAdd: importerSpecs.transientAdd,\n transientRemove: importerSpecs.transientRemove,\n })\n\n options.graph.gc()\n\n return options.graph\n}\n", "import { error } from '@vltpkg/error-cause'\nimport { graphStep } from '@vltpkg/output'\nimport { load as loadActual } from '../actual/load.ts'\nimport { load as loadVirtual } from '../lockfile/load.ts'\nimport { buildIdealFromStartingGraph } from './build-ideal-from-starting-graph.ts'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { LoadOptions as LoadActualOptions } from '../actual/load.ts'\nimport type {\n AddImportersDependenciesMap,\n RemoveImportersDependenciesMap,\n Dependency,\n} from '../dependencies.ts'\nimport type { Graph } from '../graph.ts'\nimport { splitDepID } from '@vltpkg/dep-id'\nimport type { DepID } from '@vltpkg/dep-id'\nimport type { RollbackRemove } from '@vltpkg/rollback-remove'\n\nconst getMap = <T extends Map<any, any>>(m?: T) =>\n m ?? (new Map() as T)\n\nexport type BuildIdealOptions = LoadActualOptions & {\n /**\n * An actual graph\n */\n actual?: Graph\n /**\n * A `Map` in which keys are {@link DepID} linking to another `Map` in which\n * keys are the dependency names and values are {@link Dependency}. This\n * structure represents dependencies that need to be added to the importer\n * represented by {@link DepID}.\n */\n add?: AddImportersDependenciesMap\n /**\n * A `Map` object representing nodes to be removed from the ideal graph.\n * Each {@link DepID} key represents an importer node and the `Set` of\n * dependency names to be removed from its dependency list.\n */\n remove?: RemoveImportersDependenciesMap\n /**\n * A {@link RollbackRemove} instance to handle extraction rollbacks\n */\n remover: RollbackRemove\n /**\n * A {@link PackageInfoClient} instance to read manifest info from.\n */\n packageInfo: PackageInfoClient\n}\n\n/**\n * Validates that a file dependency node exists in the graph after\n * a successful graph build. This helps providing an actionable error\n * message in case the current working directory is a linked nested\n * folder that hasn't yet been added as a dependency to an importer\n * in the project.\n */\nconst validateFileDepNode = (graph: Graph, id: DepID) => {\n const [type, path] = splitDepID(id)\n if (type === 'file' && !graph.nodes.get(id)) {\n throw error(\n 'The current working dir is not a dependency of this project',\n { path },\n )\n }\n}\n\n/**\n * Builds an ideal {@link Graph} representing the dependencies that\n * should be present in order to fulfill the requirements defined\n * by the `package.json` and `vlt-lock.json` files using either the\n * virtual or actual graph as a starting point. Also add / remove any\n * dependencies listed in the `add` and `remove` properties.\n */\nexport const build = async (\n options: BuildIdealOptions,\n): Promise<Graph> => {\n const done = graphStep('build')\n\n // Creates the shared instances that are going to be used\n // in both the loader methods and the build graph\n const { packageInfo, packageJson, scurry, monorepo } = options\n const mainManifest =\n options.mainManifest ?? packageJson.read(options.projectRoot)\n let graph\n try {\n graph = loadVirtual({\n ...options,\n mainManifest,\n monorepo,\n })\n } catch {\n graph = loadActual({\n ...options,\n mainManifest,\n monorepo,\n })\n }\n\n const res = await buildIdealFromStartingGraph({\n ...options,\n scurry,\n add: getMap(options.add),\n graph,\n packageInfo,\n remove: getMap(options.remove),\n actual: options.actual,\n })\n done()\n\n // when adding or removing a new dependency from a file dep,\n // validate the receiver node was present in the graph\n if (options.add) {\n for (const [addKey, value] of options.add.entries()) {\n if (value.size) validateFileDepNode(res, addKey)\n }\n }\n if (options.remove) {\n for (const [removeKey, value] of options.remove.entries()) {\n if (value.size) validateFileDepNode(res, removeKey)\n }\n }\n\n return res\n}\n", "import { graphStep } from '@vltpkg/output'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { RollbackRemove } from '@vltpkg/rollback-remove'\nimport { availableParallelism } from 'node:os'\nimport { callLimit } from 'promise-call-limit'\nimport type { DepID } from '@vltpkg/dep-id'\nimport type { LoadOptions } from '../actual/load.ts'\nimport { load as loadActual } from '../actual/load.ts'\nimport type {\n AddImportersDependenciesMap,\n RemoveImportersDependenciesMap,\n} from '../dependencies.ts'\nimport { Diff } from '../diff.ts'\nimport type { Graph } from '../graph.ts'\nimport type { GraphModifier } from '../modifiers.ts'\nimport {\n lockfileData,\n saveData,\n saveHidden,\n} from '../lockfile/save.ts'\nimport { addEdges } from './add-edges.ts'\nimport { addNodes } from './add-nodes.ts'\nimport { build } from './build.ts'\nimport { deleteEdges } from './delete-edges.ts'\nimport { checkNeededBuild } from './check-needed-build.ts'\nimport { deleteNodes } from './delete-nodes.ts'\nimport { internalHoist } from './internal-hoist.ts'\nimport { rollback } from './rollback.ts'\nimport { updatePackageJson } from './update-importers-package-json.ts'\nimport { copyFileSync } from 'node:fs'\nimport { Query } from '@vltpkg/query'\nimport { SecurityArchive } from '@vltpkg/security-archive'\nimport type { NodeLike } from '@vltpkg/types'\nimport { binChmodAll } from './bin-chmod.ts'\n\nconst limit = Math.max(availableParallelism() - 1, 1) * 8\n\n/**\n * Filter nodes using a DSS query string\n */\nconst filterNodesByQuery = async (\n graph: Graph,\n allowScriptsQuery?: string,\n): Promise<Set<DepID>> => {\n // shortcut no packages included\n if (\n allowScriptsQuery === ':not(*)' /* c8 ignore next */ ||\n !allowScriptsQuery\n ) {\n return new Set()\n }\n // shortcut all packages included\n if (allowScriptsQuery === '*') {\n return new Set(graph.nodes.keys())\n }\n /* c8 ignore start */\n const securityArchive =\n Query.hasSecuritySelectors(allowScriptsQuery) ?\n await SecurityArchive.start({\n nodes: [...graph.nodes.values()],\n })\n : undefined\n /* c8 ignore stop */\n\n const edges = graph.edges\n const nodes = new Set<NodeLike>(graph.nodes.values())\n const importers = graph.importers\n\n const query = new Query({\n edges,\n nodes,\n importers,\n securityArchive,\n })\n\n const { nodes: resultNodes } = await query.search(\n allowScriptsQuery,\n {\n signal: new AbortController().signal,\n },\n )\n\n return new Set(resultNodes.map(node => node.id))\n}\n\n// - [ ] depid's with peer resolutions\n// - [ ] depid shortening\n\nexport type ReifyOptions = LoadOptions & {\n add?: AddImportersDependenciesMap\n allowScripts: string\n remove?: RemoveImportersDependenciesMap\n graph: Graph\n actual?: Graph\n packageInfo: PackageInfoClient\n modifiers?: GraphModifier\n remover: RollbackRemove\n}\n\nexport type ReifyResult = {\n /**\n * The diff object that was used to reify the project.\n */\n diff: Diff\n /**\n * Optional queue of DepIDs that requires building (running lifecycle scripts\n * and binary linking) after the reification is complete.\n */\n buildQueue?: DepID[]\n}\n\n/**\n * Make the current project match the supplied graph.\n */\nexport const reify = async (\n options: ReifyOptions,\n): Promise<ReifyResult> => {\n const done = graphStep('reify')\n\n const { graph, scurry, remover } = options\n\n const actual =\n options.actual ??\n loadActual({\n ...options,\n loadManifests: true,\n })\n\n const diff = new Diff(actual, graph)\n const noModifiedDependencies =\n !options.add?.modifiedDependencies &&\n !options.remove?.modifiedDependencies\n const skipOptionalOnly = noModifiedDependencies && diff.optionalOnly\n const res: ReifyResult = { diff }\n if (!diff.hasChanges() || skipOptionalOnly) {\n // nothing to do, so just return the diff\n done()\n return res\n }\n\n let success = false\n try {\n const { buildQueue } = await reify_(options, diff, remover)\n remover.confirm()\n success = true\n res.buildQueue = buildQueue\n } finally {\n /* c8 ignore start */\n if (!success) {\n await rollback(remover, diff, scurry).catch(() => {})\n }\n /* c8 ignore stop */\n }\n\n done()\n\n return res\n}\n\nconst reify_ = async (\n options: ReifyOptions,\n diff: Diff,\n remover: RollbackRemove,\n): Promise<Omit<ReifyResult, 'diff'>> => {\n const res: Omit<ReifyResult, 'diff'> = {}\n const {\n add,\n remove,\n packageInfo,\n packageJson,\n scurry,\n allowScripts,\n } = options\n const saveImportersPackageJson =\n /* c8 ignore next */\n add?.modifiedDependencies || remove?.modifiedDependencies ?\n updatePackageJson({\n add,\n remove,\n graph: options.graph,\n packageJson,\n })\n : undefined\n\n // before anything else happens, grab the ideal tree as it was resolved\n // so that we can store it in the lockfile. We do this here so that\n // any failed/removed optional deps are not reflected in the lockfile\n // data as it is saved.\n const lfData = lockfileData(options)\n const actions: (() => Promise<unknown>)[] = addNodes(\n diff,\n scurry,\n remover,\n options,\n packageInfo,\n ).concat(deleteEdges(diff, scurry, remover))\n\n // need to wait, so that the nodes exist to link to\n if (actions.length) await callLimit(actions, { limit })\n\n // create all node_modules symlinks, and link bins to nm/.bin\n const edgeActions = addEdges(diff, scurry, remover)\n if (edgeActions.length) await callLimit(edgeActions, { limit })\n\n await internalHoist(diff.to, options, remover)\n\n // looks up all nodes setting buildState = 'needed'\n // on nodes that require building\n checkNeededBuild({ diff, scurry })\n\n // Filter nodes allowed to run scripts if allowScripts query is provided\n const allowScriptsNodes = await filterNodesByQuery(\n diff.to,\n allowScripts,\n )\n\n // ensure that all added bins are chmod +x\n await binChmodAll(diff.nodes.add, scurry)\n\n // run install lifecycle scripts and link any binary files\n await build(diff, packageJson, scurry, allowScriptsNodes)\n\n // set the buildQueue on the result object containing\n // an array with all the ids of nodes that need building\n res.buildQueue = [...diff.nodes.add]\n .filter(node => node.buildState === 'needed')\n .map(node => node.id)\n\n // if we had to change the actual graph along the way,\n // make sure we do not leave behind any unreachable nodes\n // TODO: add tests to cover this\n /* c8 ignore start */\n if (diff.hadOptionalFailures) {\n for (const node of options.graph.gc().values()) {\n diff.nodes.add.delete(node)\n diff.nodes.delete.add(node)\n }\n }\n /* c8 ignore stop */\n saveHidden(options)\n\n // delete garbage from the store.\n const rmActions: Promise<unknown>[] = deleteNodes(\n diff,\n remover,\n scurry,\n )\n if (rmActions.length) await Promise.all(rmActions)\n\n // updates package.json files if anything was added / removed\n saveImportersPackageJson?.()\n\n // write the ideal graph data to the lockfile\n saveData(lfData, scurry.resolve('vlt-lock.json'), false)\n\n // update the store config reference if a config file was used\n if (scurry.lstatSync('vlt.json')) {\n copyFileSync(\n scurry.resolve('vlt.json'),\n scurry.resolve('node_modules/.vlt/vlt.json'),\n )\n }\n\n // returns the result object\n return res\n}\n", "import * as os from 'node:os'\n// availableParallelism available only since node v19, for older versions use\n// cpus() cpus() can return an empty list if /proc is not mounted, use 1 in\n// this case\n\n/* c8 ignore start */\nconst defLimit =\n 'availableParallelism' in os ?\n Math.max(1, os.availableParallelism() - 1)\n : Math.max(1, (os as typeof import('node:os')).cpus().length - 1)\n/* c8 ignore stop */\n\nexport type Step<T> = () => Promise<T>\n\nexport type Options = {\n limit?: number\n rejectLate?: boolean\n}\n\nexport const callLimit = <T extends any>(\n queue: Step<T>[],\n { limit = defLimit, rejectLate }: Options = {},\n) =>\n new Promise((res, rej) => {\n let active = 0\n let current = 0\n const results: (T | void | Promise<void | T>)[] = []\n\n // Whether or not we rejected, distinct from the rejection just in case the rejection itself is falsey\n let rejected = false\n let rejection: unknown\n const reject = (er?: unknown) => {\n if (rejected) return\n rejected = true\n rejection ??= er\n if (!rejectLate) rej(rejection)\n }\n\n let resolved = false\n const resolve = () => {\n if (resolved || active > 0) return\n resolved = true\n res(results)\n }\n\n const run = () => {\n const c = current++\n if (c >= queue.length) return rejected ? reject() : resolve()\n\n active++\n const step = queue[c]\n /* c8 ignore start */\n if (!step) throw new Error('walked off queue')\n /* c8 ignore stop */\n\n results[c] = step()\n .then(\n result => {\n active--\n results[c] = result\n return result\n },\n er => {\n active--\n reject(er)\n },\n )\n .then(result => {\n if (rejected && active === 0) return rej(rejection)\n run()\n return result\n })\n }\n\n for (let i = 0; i < limit; i++) run()\n })\n", "// On windows, create a .cmd file.\n// Read the #! in the file to see what it uses. The vast majority\n// of the time, this will be either:\n// \"#!/usr/bin/env <prog> <args...>\"\n// or:\n// \"#!<prog> <args...>\"\n//\n// Write a binroot/pkg.bin + \".cmd\" file that has this line in it:\n// @<prog> <args...> %dp0%<target> %*\n\nimport {\n chmod,\n mkdir,\n readFile,\n stat,\n writeFile,\n} from 'node:fs/promises'\n\nimport { error } from '@vltpkg/error-cause'\nimport type { RollbackRemove } from '@vltpkg/rollback-remove'\nimport { dirname, relative } from 'node:path'\nimport { convertToSetCommands } from './to-batch-syntax.ts'\nexport {\n findCmdShim,\n findCmdShimIfExists,\n readCmdShim,\n readCmdShimIfExists,\n} from './read.ts'\n\nconst shebangExpr =\n /^#!\\s*(?:\\/usr\\/bin\\/env\\s+(?:-S\\s+)?((?:[^ \\t=]+=[^ \\t=]+\\s+)*))?([^ \\t]+)(.*)$/\n\nexport const cmdShimIfExists = async (\n from: string,\n to: string,\n remover: RollbackRemove,\n) => {\n try {\n await stat(from)\n } catch {\n return\n }\n await writeShim(from, to, remover)\n}\n\nexport const cmdShim = async (\n from: string,\n to: string,\n remover: RollbackRemove,\n) => {\n try {\n await stat(from)\n await writeShim(from, to, remover)\n } catch (er) {\n throw error('Could not shim to executable file', {\n path: from,\n target: to,\n cause: er,\n })\n }\n}\n\nconst writeShim = async (\n from: string,\n to: string,\n remover: RollbackRemove,\n) => {\n await Promise.all([\n remover.rm(to),\n remover.rm(to + '.cmd'),\n remover.rm(to + '.ps1'),\n remover.rm(to + '.pwsh'),\n ])\n // make a cmd file and a sh script\n // First, check if the bin is a #! of some sort.\n // If not, then assume it's something that'll be compiled, or some other\n // sort of script, and just call it directly.\n await mkdir(dirname(to), { recursive: true })\n const data = await readFile(from, 'utf8').catch(() => '')\n if (!data) {\n return await writeShim_(from, to)\n }\n const firstLine = data.trim().split(/\\r*\\n/)[0]\n const shebang = firstLine?.match(shebangExpr) ?? undefined\n return writeShim_(\n from,\n to,\n shebang?.[2],\n shebang?.[3],\n shebang?.[1],\n )\n}\n\nconst writeShim_ = async (\n from: string,\n to: string,\n prog?: string,\n args?: string,\n variables?: string,\n) => {\n let shTarget = relative(dirname(to), from)\n let target = shTarget.split('/').join('\\\\')\n let longProg\n let shProg = prog?.split('\\\\').join('/')\n let shLongProg\n let pwshProg = shProg && `\"${shProg}$exe\"`\n let pwshLongProg\n shTarget = shTarget.split('\\\\').join('/')\n args = args || ''\n variables = variables || ''\n if (!prog) {\n prog = `\"%dp0%\\\\${target}\"`\n shProg = `\"$basedir/${shTarget}\"`\n pwshProg = shProg\n args = ''\n target = ''\n shTarget = ''\n } else {\n longProg = `\"%dp0%\\\\${prog}.exe\"`\n shLongProg = `\"$basedir/${prog}\"`\n pwshLongProg = `\"$basedir/${prog}$exe\"`\n target = `\"%dp0%\\\\${target}\"`\n shTarget = `\"$basedir/${shTarget}\"`\n }\n\n // Subroutine trick to fix https://github.com/npm/cmd-shim/issues/10\n // and https://github.com/npm/cli/issues/969\n const head =\n '@ECHO off\\r\\n' +\n 'GOTO start\\r\\n' +\n ':find_dp0\\r\\n' +\n 'SET dp0=%~dp0\\r\\n' +\n 'EXIT /b\\r\\n' +\n ':start\\r\\n' +\n 'SETLOCAL\\r\\n' +\n 'CALL :find_dp0\\r\\n'\n\n let cmd\n if (longProg) {\n /* c8 ignore next */\n shLongProg = (shLongProg ?? '').trim()\n args = args.trim()\n const variablesBatch = convertToSetCommands(variables)\n cmd =\n `${head}${variablesBatch}\\r\\n` +\n `IF EXIST ${longProg} (\\r\\n` +\n ` SET \"_prog=${longProg.replace(/(^\")|(\"$)/g, '')}\"\\r\\n` +\n ') ELSE (\\r\\n' +\n ` SET \"_prog=${prog.replace(/(^\")|(\"$)/g, '')}\"\\r\\n` +\n ' SET PATHEXT=%PATHEXT:;.JS;=;%\\r\\n' +\n ')\\r\\n' +\n '\\r\\n' +\n // prevent \"Terminate Batch Job? (Y/n)\" message\n // https://github.com/npm/cli/issues/969#issuecomment-737496588\n 'endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & ' +\n `\"%_prog%\" ${args} ${target} %*\\r\\n`\n } else {\n cmd = `${head}${prog} ${args} ${target} %*\\r\\n`\n }\n\n let sh =\n '#!/bin/sh\\n' +\n `basedir=$(dirname \"$(echo \"$0\" | sed -e 's,\\\\\\\\,/,g')\")\\n` +\n '\\n' +\n 'case `uname` in\\n' +\n ' *CYGWIN*|*MINGW*|*MSYS*)\\n' +\n ' if command -v cygpath > /dev/null 2>&1; then\\n' +\n ' basedir=`cygpath -w \"$basedir\"`\\n' +\n ' fi\\n' +\n ' ;;\\n' +\n 'esac\\n' +\n '\\n'\n\n if (shLongProg) {\n sh +=\n `if [ -x ${shLongProg} ]; then\\n` +\n ` exec ${variables}${shLongProg} ${args} ${shTarget} \"$@\"\\n` +\n 'else \\n' +\n ` exec ${variables}${shProg} ${args} ${shTarget} \"$@\"\\n` +\n 'fi\\n'\n } else {\n sh += `exec ${shProg} ${args} ${shTarget} \"$@\"\\n`\n }\n\n let pwsh =\n '#!/usr/bin/env pwsh\\n' +\n '$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent\\n' +\n '\\n' +\n '$exe=\"\"\\n' +\n 'if ($PSVersionTable.PSVersion -lt \"6.0\" -or $IsWindows) {\\n' +\n ' # Fix case when both the Windows and Linux builds of Node\\n' +\n ' # are installed in the same directory\\n' +\n ' $exe=\".exe\"\\n' +\n '}\\n'\n\n if (shLongProg) {\n pwsh +=\n '$ret=0\\n' +\n `if (Test-Path ${pwshLongProg}) {\\n` +\n ' # Support pipeline input\\n' +\n ' if ($MyInvocation.ExpectingInput) {\\n' +\n ` $input | & ${pwshLongProg} ${args} ${shTarget} $args\\n` +\n ' } else {\\n' +\n ` & ${pwshLongProg} ${args} ${shTarget} $args\\n` +\n ' }\\n' +\n ' $ret=$LASTEXITCODE\\n' +\n '} else {\\n' +\n ' # Support pipeline input\\n' +\n ' if ($MyInvocation.ExpectingInput) {\\n' +\n ` $input | & ${pwshProg} ${args} ${shTarget} $args\\n` +\n ' } else {\\n' +\n ` & ${pwshProg} ${args} ${shTarget} $args\\n` +\n ' }\\n' +\n ' $ret=$LASTEXITCODE\\n' +\n '}\\n' +\n 'exit $ret\\n'\n } else {\n pwsh +=\n '# Support pipeline input\\n' +\n 'if ($MyInvocation.ExpectingInput) {\\n' +\n ` $input | & ${pwshProg} ${args} ${shTarget} $args\\n` +\n '} else {\\n' +\n ` & ${pwshProg} ${args} ${shTarget} $args\\n` +\n '}\\n' +\n 'exit $LASTEXITCODE\\n'\n }\n\n await Promise.all([\n writeFile(to + '.cmd', cmd, 'utf8'),\n writeFile(to + '.ps1', pwsh, 'utf8'),\n writeFile(to, sh, 'utf8'),\n ])\n await chmodShim(to)\n}\n\nconst chmodShim = async (to: string) =>\n await Promise.all([\n chmod(to, 0o755),\n chmod(to + '.cmd', 0o755),\n chmod(to + '.ps1', 0o755),\n ])\n", "export const convertToSetCommand = (key: string, value: string) =>\n convertToSetCommand_(key.trim(), value.trim())\n\nconst convertToSetCommand_ = (key: string, value: string) =>\n key && value ?\n `@SET ${key}=${replaceDollarWithPercentPair(value)}\\r\\n`\n : ''\n\nconst extractVariableValuePairs = (declarations: string[]) =>\n declarations.reduce(\n (pairs: Record<string, string>, declaration) => {\n const [key = '', val = ''] = declaration.split('=')\n pairs[key] = val\n return pairs\n },\n {},\n )\n\nexport const convertToSetCommands = (variableString: string) =>\n Object.entries(extractVariableValuePairs(variableString.split(' ')))\n .map(([key, val]) => convertToSetCommand(key, val))\n .join('')\n\nexport const replaceDollarWithPercentPair = (value: string) => {\n const dollarExpressions = /\\$\\{?([^$@#?\\- \\t{}:]+)\\}?/g\n let result = ''\n let startIndex = 0\n do {\n const match = dollarExpressions.exec(value)\n if (match) {\n const betweenMatches =\n value.substring(startIndex, match.index) || ''\n result += betweenMatches + '%' + String(match[1]) + '%'\n startIndex = dollarExpressions.lastIndex\n }\n } while (dollarExpressions.lastIndex > 0)\n result += value.slice(startIndex)\n return result\n}\n", "import { error } from '@vltpkg/error-cause'\nimport { lstat, readFile, readlink } from 'node:fs/promises'\nimport { dirname, resolve } from 'node:path'\nimport { paths } from './paths.ts'\n\nconst extractPath = (path: string, cmdshimContents: string) => {\n if (/\\.cmd$/i.test(path)) {\n return extractPathFromCmd(cmdshimContents)\n } else if (/\\.(ps1|pwsh)$/i.test(path)) {\n return extractPathFromPowershell(cmdshimContents)\n } else {\n return extractPathFromCygwin(cmdshimContents)\n }\n}\n\nconst extractPathFromPowershell = (cmdshimContents: string) => {\n const matches = /\"[$]basedir\\/([^\"]+?)\"\\s+[$]args/.exec(\n cmdshimContents,\n )\n return matches?.[1]?.replace(/\\\\/g, '/')\n}\n\nconst extractPathFromCmd = (cmdshimContents: string) => {\n const matches = /\"%(?:~dp0|dp0%)\\\\([^\"]+?)\"\\s+%[*]/.exec(\n cmdshimContents,\n )\n return matches?.[1]?.replace(/\\\\/g, '/')\n}\n\nconst extractPathFromCygwin = (cmdshimContents: string) => {\n const matches = /\"[$]basedir\\/([^\"]+?)\"\\s+\"[$]@\"/.exec(\n cmdshimContents,\n )\n return matches?.[1]?.replace(/\\\\/g, '/')\n}\n\n/**\n * Find a matching cmd, cygwin, powershell, or symlink executable,\n * and return the matching file and the target it references in a\n * `[string,string]` tuple if found, or undefined if not.\n */\nexport const findCmdShimIfExists = async (\n path: string,\n): Promise<undefined | [string, string]> => {\n path = path.replace(/\\.(cmd|pwsh|ps1)$/i, '')\n for (const p of paths(path)) {\n const result = await readCmdShimIfExists(p)\n if (result) return [p, result]\n }\n}\n\n/**\n * Find a matching cmd, cygwin, powershell, or symlink executable,\n * and return the matching file and the target it references in a\n * `[string,string]` tuple if found, or throw if not found.\n */\nexport const findCmdShim = async (path: string) => {\n const result = await findCmdShimIfExists(path)\n if (result) return result\n throw error(\n 'Could not find matching cmd shim',\n { path },\n findCmdShim,\n )\n}\n\n/**\n * Read the specified executable shim if it exists, returning the\n * target it references. Return undefined if it does not exist\n * or cannot be dereferenced.\n */\nexport const readCmdShimIfExists = async (path: string) => {\n try {\n const st = await lstat(path)\n if (st.isSymbolicLink()) {\n return resolve(dirname(path), await readlink(path))\n }\n const contents = await readFile(path)\n const destination = extractPath(path, contents.toString())\n if (destination) return resolve(dirname(path), destination)\n } catch {}\n}\n\n/**\n * Read the specified executable shim, returning the target\n * it references. Raise an error if it does not exist or cannot be read.\n */\nexport const readCmdShim = async (path: string) => {\n try {\n const st = await lstat(path)\n if (st.isSymbolicLink()) {\n return resolve(dirname(path), await readlink(path))\n }\n // create a new error to capture the stack trace from this point,\n // instead of getting some opaque stack into node's internals\n const contents = await readFile(path)\n const destination = extractPath(path, contents.toString())\n if (destination) return resolve(dirname(path), destination)\n } catch (er) {\n throw error(\n 'Could not read shim',\n { path, cause: er },\n readCmdShim,\n )\n }\n throw error('Not a valid cmd shim', { path }, readCmdShim)\n}\n", "// On non-windows platforms, we only look for symlinks, not shims\n/* c8 ignore start */\nexport const paths =\n process.platform === 'win32' ?\n (path: string) => [\n path + '.cmd',\n path + '.ps1',\n path,\n path + '.pwsh',\n ]\n : (path: string) => [path]\n/* c8 ignore stop */\n", "import { cmdShimIfExists } from '@vltpkg/cmd-shim'\nimport type { RollbackRemove } from '@vltpkg/rollback-remove'\nimport { mkdir, symlink } from 'node:fs/promises'\nimport { dirname, relative } from 'node:path'\nimport type { PathScurry } from 'path-scurry'\nimport type { Edge } from '../edge.ts'\n\nconst clobberSymlink = async (\n target: string,\n link: string,\n remover: RollbackRemove,\n type = 'file',\n) => {\n await mkdir(dirname(link), { recursive: true })\n try {\n await symlink(target, link, type)\n } catch (er) {\n /* c8 ignore start */\n if ((er as NodeJS.ErrnoException).code !== 'EEXIST') {\n throw er\n }\n /* c8 ignore stop */\n\n // if the symlink exists, remove it\n await remover.rm(link)\n\n try {\n // then try to create it again\n await symlink(target, link, type)\n /* c8 ignore start */\n } catch (er) {\n // if the symlink still exists, then multiple paths could be writing to it\n // so now just ignore that error. See https://github.com/vltpkg/vltpkg/issues/797\n if ((er as NodeJS.ErrnoException).code !== 'EEXIST') {\n throw er\n }\n }\n /* c8 ignore stop */\n }\n}\n\n/**\n * reify an edge into a node_modules folder, with bins linked\n * this does NOT chmod the bins to 0o777, because they might not exist\n * until scripts are run, in the case of non-store deps like workspaces\n */\nexport const addEdge = async (\n edge: Edge,\n scurry: PathScurry,\n remover: RollbackRemove,\n bins?: Record<string, string>,\n) => {\n if (!edge.to) return\n const binRoot = scurry.resolve(\n edge.from.nodeModules(scurry),\n '.bin',\n )\n const path = scurry.resolve(\n edge.from.nodeModules(scurry),\n edge.spec.name,\n )\n const promises: Promise<unknown>[] = []\n const target = relative(\n dirname(path),\n edge.to.resolvedLocation(scurry),\n )\n\n // can only parallelize this on posix, because the win32 shims\n // need to know that they will exist before being created.\n const p = clobberSymlink(target, path, remover, 'dir')\n if (process.platform === 'win32') await p\n else promises.push(p)\n\n if (bins) {\n for (const [key, val] of Object.entries(bins)) {\n const link = scurry.resolve(binRoot, key)\n const absTarget = scurry.resolve(path, val)\n const target = relative(binRoot, absTarget)\n // TODO: bash/cmd/ps1 shims on Windows\n promises.push(\n process.platform === 'win32' ?\n cmdShimIfExists(absTarget, link, remover)\n : clobberSymlink(target, link, remover),\n )\n }\n }\n if (promises.length) await Promise.all(promises)\n}\n", "import type { RollbackRemove } from '@vltpkg/rollback-remove'\nimport type { PathScurry } from 'path-scurry'\nimport type { Diff } from '../diff.ts'\nimport { addEdge } from './add-edge.ts'\n\nexport const addEdges = (\n diff: Diff,\n scurry: PathScurry,\n remover: RollbackRemove,\n): (() => Promise<unknown>)[] => {\n const actions: (() => Promise<unknown>)[] = []\n for (const edge of diff.edges.add) {\n const { to } = edge\n if (!to) continue\n const bins = to.bins\n actions.push(() => addEdge(edge, scurry, remover, bins))\n }\n return actions\n}\n", "import type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { RollbackRemove } from '@vltpkg/rollback-remove'\nimport type { SpecOptions } from '@vltpkg/spec'\nimport type { PathScurry } from 'path-scurry'\nimport type { Diff } from '../diff.ts'\nimport { extractNode } from './extract-node.ts'\n\nexport const addNodes = (\n diff: Diff,\n scurry: PathScurry,\n remover: RollbackRemove,\n options: SpecOptions,\n packageInfo: PackageInfoClient,\n): (() => Promise<unknown>)[] => {\n const actions: (() => Promise<unknown>)[] = []\n // fetch and extract all the nodes, removing any in the way\n for (const node of diff.nodes.add) {\n // if it's not in the store, we don't have to extract it, because\n // we're just linking to a location that already exists.\n if (!node.inVltStore()) continue\n\n // skip nodes that have already been extracted\n if (node.extracted) continue\n\n actions.push(() =>\n extractNode(node, scurry, remover, options, packageInfo, diff),\n )\n }\n return actions\n}\n", "import type { RollbackRemove } from '@vltpkg/rollback-remove'\nimport type { PathScurry } from 'path-scurry'\nimport type { Edge } from '../edge.ts'\n\nconst rmBinPosix = (remover: RollbackRemove, bin: string) => {\n return [remover.rm(bin)]\n}\n\nconst rmBinWin32 = (remover: RollbackRemove, bin: string) => {\n return [\n remover.rm(bin),\n remover.rm(bin + '.cmd'),\n remover.rm(bin + '.ps1'),\n ]\n}\n\nconst rmBin = process.platform === 'win32' ? rmBinWin32 : rmBinPosix\n\nexport const deleteEdge = async (\n edge: Edge,\n scurry: PathScurry,\n remover: RollbackRemove,\n) => {\n const {\n spec: { name },\n to,\n } = edge\n const nm = edge.from.nodeModules(scurry)\n const path = scurry.resolve(nm, name)\n const binRoot = scurry.cwd.resolve(`${nm}/.bin`)\n const promises: Promise<unknown>[] = []\n promises.push(remover.rm(path))\n const bins = to?.bins\n if (bins) {\n for (const key of Object.keys(bins)) {\n const bin = binRoot.resolve(key).fullpath()\n promises.push(...rmBin(remover, bin))\n }\n }\n await Promise.all(promises)\n}\n", "import type { RollbackRemove } from '@vltpkg/rollback-remove'\nimport type { PathScurry } from 'path-scurry'\nimport type { Diff } from '../diff.ts'\nimport { deleteEdge } from './delete-edge.ts'\n\nexport const deleteEdges = (\n diff: Diff,\n scurry: PathScurry,\n remover: RollbackRemove,\n): (() => Promise<unknown>)[] => {\n const promises: (() => Promise<unknown>)[] = []\n for (const edge of diff.edges.delete) {\n // if the edge.from is a deleted node in the store, no need\n // the entire dir will be removed in a later step.\n if (diff.nodes.delete.has(edge.from) && edge.from.inVltStore()) {\n continue\n }\n promises.push(() => deleteEdge(edge, scurry, remover))\n }\n return promises\n}\n", "import type { PathScurry } from 'path-scurry'\nimport type { Diff } from '../diff.ts'\nimport type { Node } from '../node.ts'\nimport { join } from 'node:path'\n\n/**\n * Build data containing the queue of DepIDs that need building\n */\nexport type BuildData = {\n needsBuildNodes: Node[]\n}\n\n/**\n * Options for checking needed build data\n */\nexport type CheckNeededBuildOptions = {\n /**\n * The diff object containing nodes to process\n */\n diff: Diff\n /**\n * PathScurry instance for filesystem access\n */\n scurry: PathScurry\n}\n\n/**\n * Checks if a node needs to be built based on the conditions from build.ts:\n * 1. Has install lifecycle scripts (install, preinstall, postinstall)\n * 2. Has binding.gyp file with no install/preinstall scripts (implicit install)\n * 3. Is an importer or git dependency with prepare scripts (prepare, preprepare, postprepare)\n * 4. Has binary files that need to be linked\n */\nconst nodeNeedsBuild = (node: Node, scurry: PathScurry): boolean => {\n // If the node has already been built during reify, no need to build again\n if (node.built) return false\n\n const { manifest } = node\n /* c8 ignore next */\n if (!manifest) return false\n\n const { scripts = {} } = manifest\n\n // Check for install lifecycle scripts\n const runInstall = !!(\n scripts.install ||\n scripts.preinstall ||\n scripts.postinstall\n )\n if (runInstall) return true\n\n // Check for binding.gyp file (npm's implicit install detection)\n // \"If there is a binding.gyp file in the root of your package and you\n // haven't defined your own install or preinstall scripts, npm will default\n // the install command to compile using node-gyp via node-gyp rebuild\"\n const hasBindingGyp =\n scurry\n .lstatSync(join(node.resolvedLocation(scurry), 'binding.gyp'))\n ?.isFile() ?? false\n if (hasBindingGyp && !scripts.install && !scripts.preinstall)\n return true\n\n // Check for prepare scripts on importers or git dependencies\n const prepable =\n node.id.startsWith('git') || node.importer || !node.inVltStore()\n const runPrepare =\n !!(\n (scripts.prepare || scripts.preprepare || scripts.postprepare)\n /* c8 ignore next 2 */\n ) && prepable\n if (runPrepare) return true\n\n return false\n}\n\n/**\n * Check which nodes need to be built and set buildState accordingly\n * Marks nodes with buildState = 'needed' for those that require\n * install lifecycle scripts as part of `vlt build`\n * @returns {BuildData} The BuildData object containing Node objects that need building\n */\nexport const checkNeededBuild = (\n options: CheckNeededBuildOptions,\n): BuildData => {\n const { diff, scurry } = options\n\n // Filter nodes to only include those that actually need to be built\n const nodesToBuild = [...diff.nodes.add].filter(node =>\n nodeNeedsBuild(node, scurry),\n )\n\n // Set buildState = 'needed' on all nodes that require building\n for (const node of nodesToBuild) {\n node.buildState = 'needed'\n }\n\n const buildData: BuildData = {\n needsBuildNodes: nodesToBuild,\n }\n\n return buildData\n}\n", "import type { RollbackRemove } from '@vltpkg/rollback-remove'\nimport type { PathScurry } from 'path-scurry'\nimport type { Diff } from '../diff.ts'\nimport { deleteEdge } from './delete-edge.ts'\n\nexport const deleteNodes = (\n diff: Diff,\n remover: RollbackRemove,\n scurry: PathScurry,\n): Promise<unknown>[] => {\n const store = scurry.resolve('node_modules/.vlt')\n const rmActions: Promise<unknown>[] = []\n for (const node of diff.nodes.delete) {\n // do not delete workspaces or link targets\n if (!node.inVltStore()) continue\n rmActions.push(remover.rm(scurry.resolve(store, node.id)))\n for (const edge of node.edgesIn) {\n rmActions.push(deleteEdge(edge, scurry, remover))\n }\n }\n return rmActions\n}\n", "import type { DepID, DepIDTuple } from '@vltpkg/dep-id'\nimport { splitDepID } from '@vltpkg/dep-id'\nimport type { RollbackRemove } from '@vltpkg/rollback-remove'\nimport { Version } from '@vltpkg/semver'\nimport { mkdir, symlink } from 'node:fs/promises'\nimport { dirname, relative } from 'node:path'\nimport type { PathBase, PathScurry } from 'path-scurry'\nimport type { Graph } from '../graph.ts'\nimport type { Node } from '../node.ts'\nimport type { ReifyOptions } from './index.ts'\n\ntype InternalHoistOptions = Pick<\n ReifyOptions,\n 'projectRoot' | 'scurry'\n>\n\nexport const pickNodeToHoist = (\n nodes: Set<Node>,\n): Node | undefined => {\n let pick: DepIDTuple | undefined = undefined\n let pickNode: Node | undefined = undefined\n for (const node of nodes) {\n if (node.importer || !node.inVltStore()) {\n continue\n }\n const id = splitDepID(node.id)\n if (!pick || !pickNode) {\n pick = id\n pickNode = node\n continue\n }\n\n // if one is a dep of an importer, privilege that one\n const impDep = [...node.edgesIn].some(n => n.from.importer)\n const pickImpDep = [...pickNode.edgesIn].some(\n n => n.from.importer,\n )\n if (impDep !== pickImpDep) {\n if (!pickImpDep) {\n pick = id\n pickNode = node\n }\n continue\n }\n\n if (id[0] === 'registry') {\n if (pick[0] !== 'registry') {\n pick = id\n pickNode = node\n continue\n }\n\n // both registry.\n\n // otherwise, privilege the higher-version dependency\n const pickVersion = pickNode.version\n const nodeVersion = node.version\n if (pickVersion) {\n if (!nodeVersion) continue\n if (\n Version.parse(nodeVersion).greaterThan(\n Version.parse(pickVersion),\n )\n ) {\n pick = id\n pickNode = node\n }\n continue\n } else if (nodeVersion) {\n pick = id\n pickNode = node\n continue\n }\n } else {\n // current node is not registry\n if (pick[0] === 'registry') continue\n // neither is pick node, select highest lexically sorted\n if (pickNode.id.localeCompare(node.id, 'en') > 0) {\n pick = id\n pickNode = node\n }\n }\n }\n\n return pickNode\n}\n\nexport const internalHoist = async (\n graph: Graph,\n options: InternalHoistOptions,\n remover: RollbackRemove,\n) => {\n // create a list of all the nodes that we need to hoist.\n // For each name, we prioritize registry deps over other types,\n // and higher versions over lower ones. In the case of non-registry\n // deps, we just pick the first item by sorting the DepIDs.\n const links = new Map<string, { id: DepID; name: string }>()\n for (const [name, nodes] of graph.nodesByName) {\n const pickNode = pickNodeToHoist(nodes)\n if (pickNode) {\n let picked = false\n if (pickNode.edgesIn.size > 0) {\n for (const edgeIn of pickNode.edgesIn) {\n const otherName = edgeIn.name\n if (otherName !== name && !links.has(otherName)) {\n picked = true\n links.set(otherName, pickNode)\n }\n }\n }\n if (!picked) {\n links.set(name, pickNode)\n }\n }\n }\n\n // now we have a list of everything to hoist\n // first, remove anything that is not what we want, and skip\n // anything that would be linking what we already indend to link.\n const { scurry } = options\n\n const hoistDir = scurry.cwd.resolve(\n 'node_modules/.vlt/node_modules',\n )\n await mkdir(hoistDir.fullpath(), { recursive: true })\n\n const removes: Promise<void>[] = []\n for (const entry of await hoistDir.readdir()) {\n const name = entry.name\n // scoped package namespace\n if (name.startsWith('@')) {\n for (const pkg of await entry.readdir()) {\n await checkExisting(\n `${name}/${pkg.name}`,\n pkg,\n links,\n removes,\n scurry,\n remover,\n )\n }\n } else {\n await checkExisting(\n name,\n entry,\n links,\n removes,\n scurry,\n remover,\n )\n }\n }\n await Promise.all(removes)\n\n const symlinks: Promise<void>[] = []\n for (const [name, { name: nodeName, id }] of links) {\n const target = scurry.resolve(\n `node_modules/.vlt/${id}/node_modules/${nodeName}`,\n )\n const path = scurry.resolve(\n `node_modules/.vlt/node_modules/${name}`,\n )\n if (name.includes('/')) {\n await mkdir(dirname(path), { recursive: true })\n }\n symlinks.push(\n symlink(relative(dirname(path), target), path, 'dir'),\n )\n }\n await Promise.all(symlinks)\n}\n\nconst checkExisting = async (\n name: string,\n entry: PathBase,\n links: Map<string, { name: string; id: DepID }>,\n removes: Promise<void>[],\n scurry: PathScurry,\n remover: RollbackRemove,\n) => {\n const target = await entry.readlink()\n const { id } = links.get(name) /* c8 ignore next */ ?? {}\n if (\n !target ||\n !id ||\n target !==\n scurry.cwd.resolve(\n `node_modules/.vlt/${id}/node_modules/${name}`,\n )\n ) {\n removes.push(remover.rm(entry.fullpath()))\n } else {\n links.delete(name)\n }\n}\n", "import { RollbackRemove } from '@vltpkg/rollback-remove'\nimport type { PathScurry } from 'path-scurry'\nimport type { Diff } from '../diff.ts'\nimport { deleteEdge } from './delete-edge.ts'\n\nexport const rollback = async (\n remover: RollbackRemove,\n diff: Diff,\n scurry: PathScurry,\n) => {\n const promises: Promise<unknown>[] = []\n const store = scurry.resolve('node_modules/.vlt')\n\n // remove everything the diff tried to add\n const backRoller = new RollbackRemove()\n for (const node of diff.nodes.add) {\n if (!node.inVltStore()) continue\n const path = scurry.resolve(store, node.id)\n /* c8 ignore next */\n promises.push(backRoller.rm(path).catch(() => {}))\n }\n for (const edge of diff.edges.add) {\n promises.push(deleteEdge(edge, scurry, backRoller))\n }\n\n /* c8 ignore next */\n await Promise.all(promises).catch(() => {})\n\n backRoller.confirm()\n\n /* c8 ignore next */\n await remover.rollback().catch(() => {})\n}\n", "import type { Spec } from '@vltpkg/spec'\nconst SAVE_PREFIX = '^'\n\nexport const calculateSaveValue = (\n nodeType: string,\n spec: Spec,\n existing: string | undefined,\n nodeVersion: string | undefined,\n): string => {\n if (\n // if not from the registry, save whatever we requested\n nodeType === 'registry' &&\n // if we installed exactly what we already wanted, leave it untouched\n spec.bareSpec !== existing &&\n // if we installed a specific version, keep that specific version.\n !spec.final.range?.isSingle\n ) {\n // if we had a single version, and got that version, then\n // leave it as-is.\n if (existing && existing === nodeVersion) {\n // depend on 1.2.3, got 1.2.3, keep unchanged\n return existing\n } else if (existing && !spec.bareSpec) {\n // if we had `\"express\": \"5.1\"` and did `vlt i express`,\n // then leave it as-is, because we just installed our pj dep\n return existing\n } else {\n const finalRange =\n (spec.final.semver && spec.final.bareSpec) ||\n `${SAVE_PREFIX}${nodeVersion}`\n // didn't have dep previously, or depended on a different thing\n // than what was requested. Update with the ^ range based on\n // the node that landed in the graph, but preserve alias prefix\n if (spec.subspec && spec.final.namedRegistry) {\n return `${spec.final.namedRegistry}:${spec.final.name}@${finalRange}`\n }\n\n if (spec.final.namedJsrRegistry) {\n // if we were given an alternative name, preserve that\n // do this with a regexp because the Spec objects get a little\n // weird here, and the string is relatively straightforward.\n return spec.bareSpec\n .replace(\n new RegExp(\n `^(?:.*?@)?${spec.final.namedJsrRegistry}:(@[^/]+/[^@]+)(@.*?)?$`,\n ),\n `${spec.final.namedJsrRegistry}:$1@${finalRange}`,\n )\n .replace(\n // otherwise, swap out the final version for the save range\n new RegExp(\n `^(?:.*?@)?${spec.final.namedJsrRegistry}:([^@].*?)?$`,\n ),\n `${spec.final.namedJsrRegistry}:${finalRange}`,\n )\n }\n return finalRange\n }\n }\n return spec.bareSpec\n}\n", "import type { DepID } from '@vltpkg/dep-id'\nimport { splitDepID } from '@vltpkg/dep-id'\nimport { error } from '@vltpkg/error-cause'\nimport type { PackageJson } from '@vltpkg/package-json'\nimport type {\n DependencyTypeLong,\n DependencyTypeShort,\n NormalizedManifest,\n} from '@vltpkg/types'\nimport { longDependencyTypes } from '@vltpkg/types'\nimport type {\n AddImportersDependenciesMap,\n Dependency,\n RemoveImportersDependenciesMap,\n} from '../dependencies.ts'\nimport type { Graph } from '../graph.ts'\nimport { resolveSaveType } from '../resolve-save-type.ts'\nimport { calculateSaveValue } from './calculate-save-value.ts'\n\nconst depTypesMap = new Map<DependencyTypeShort, DependencyTypeLong>([\n ['prod', 'dependencies'],\n ['dev', 'devDependencies'],\n ['peer', 'peerDependencies'],\n ['peerOptional', 'peerDependencies'],\n ['optional', 'optionalDependencies'],\n])\n\nexport type UpdatePackageJsonOptions = {\n /**\n * A `Map` in which keys are {@link DepID} linking to another `Map` in which\n * keys are the dependency names and values are {@link Dependency}. This\n * structure represents dependencies that need to be added to the importer\n * represented by {@link DepID}.\n */\n add?: AddImportersDependenciesMap\n /**\n * A `Map` object representing nodes to be removed from the ideal graph.\n * Each {@link DepID} key represents an importer node and the `Set` of\n * dependency names to be removed from its dependency list.\n */\n remove?: RemoveImportersDependenciesMap\n /**\n * The {@link Graph} instance that contain the importer nodes to which\n * the manifest data (and it's corresponding `package.json` file) are\n * going to be updated.\n */\n graph: Graph\n /**\n * An instance of {@link PackageJson} to use when writing updated manifest\n * data to `package.json` files. It's necessary that this is the same\n * instance used to load these `package.json` files previously.\n */\n packageJson: PackageJson\n}\n\nconst addOrRemoveDeps = (\n nodeId: DepID,\n graph: Graph,\n addOrRemove?:\n | AddImportersDependenciesMap\n | RemoveImportersDependenciesMap,\n): NormalizedManifest | undefined => {\n const node = graph.nodes.get(nodeId)\n if (!node) {\n throw error('Failed to retrieve node', {\n found: nodeId,\n })\n }\n const manifest = node.manifest\n if (!manifest) {\n throw error('Could not find manifest data for node', {\n found: nodeId,\n })\n }\n const deps = addOrRemove?.get(nodeId)\n /* c8 ignore start -- impossible but TS doesn't know that */\n if (!deps) {\n throw error('Failed to retrieve added deps info', {\n manifest,\n })\n }\n let manifestChanged = false\n /* c8 ignore stop */\n for (const deleteNameOrAddItem of deps) {\n if (typeof deleteNameOrAddItem === 'string') {\n const name = deleteNameOrAddItem\n for (const depType of longDependencyTypes) {\n if (manifest[depType]?.[name]) {\n delete manifest[depType][name]\n manifestChanged = true\n }\n }\n if (manifest.peerDependenciesMeta?.[name]) {\n delete manifest.peerDependenciesMeta[name]\n manifestChanged = true\n }\n } else {\n const [name, dep] = deleteNameOrAddItem\n // peerOptional also needs to add peerDependenciesMeta entry\n const depTypeShort = resolveSaveType(node, name, dep.type)\n const depType = depTypesMap.get(depTypeShort)\n if (!depType) {\n throw error('Failed to retrieve dependency type', {\n validOptions: [...depTypesMap.keys()],\n found: dep.type,\n })\n }\n const n = node.edgesOut.get(name)?.to\n if (!n) {\n throw error('Dependency node could not be found')\n }\n const [nodeType] = splitDepID(n.id)\n\n for (const dtype of longDependencyTypes) {\n if (dtype === depType || !manifest[dtype]) continue\n delete manifest[dtype][name]\n }\n if (depTypeShort === 'peerOptional') {\n manifest.peerDependenciesMeta ??= {}\n manifest.peerDependenciesMeta[name] = { optional: true }\n } else if (manifest.peerDependenciesMeta?.[name]) {\n delete manifest.peerDependenciesMeta[name]\n }\n\n const dependencies =\n manifest[depType] ?? (manifest[depType] = {})\n // check to see if we need to save a different version\n // - If you install a single specific version, that is deliberate,\n // we save that exact version, no matter what.\n // - If the requested spec matches the manifest, make no change\n // If the requested spec had no bareSpec, and the manifest has\n // a dependency entry, make no change.\n // If the requested spec has a bareSpec that did NOT match the manifest,\n // then update it.\n // If the manifest does not contain anything, then update it.\n // Only for registry dependencies\n const existing = dependencies[name]\n const saveValue = calculateSaveValue(\n nodeType,\n dep.spec,\n existing,\n n.version,\n )\n dependencies[name] = saveValue\n manifestChanged = manifestChanged || saveValue !== existing\n }\n }\n return manifestChanged ? manifest : undefined\n}\n\n/**\n * Updates nodes of a provided {@link Graph} accordingly to the\n * provided add or remove arguments.\n */\nexport const updatePackageJson = ({\n add,\n graph,\n packageJson,\n remove,\n}: UpdatePackageJsonOptions) => {\n const manifestsToUpdate = new Set<NormalizedManifest>()\n const operations = new Set([add, remove])\n\n for (const operation of operations) {\n if (operation) {\n // These node ids are from either importer nodes or dependencies\n // that are nested folders from which the user can also add new\n // dependencies to\n for (const nodeId of operation.keys()) {\n const manifest = addOrRemoveDeps(nodeId, graph, operation)\n if (manifest) {\n manifestsToUpdate.add(manifest)\n }\n }\n }\n }\n\n const commit = () => {\n for (const manifest of manifestsToUpdate) {\n packageJson.save(manifest)\n }\n }\n\n return commit\n}\n", "import { load as actualLoad } from './actual/load.ts'\nimport { build as idealBuild } from './ideal/build.ts'\nimport { reify } from './reify/index.ts'\nimport { GraphModifier } from './modifiers.ts'\nimport { init } from '@vltpkg/init'\nimport { error } from '@vltpkg/error-cause'\nimport type { NormalizedManifest } from '@vltpkg/types'\nimport { asError } from '@vltpkg/types'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { LoadOptions } from './actual/load.ts'\nimport { getDependencies } from './dependencies.ts'\nimport type {\n AddImportersDependenciesMap,\n Dependency,\n RemoveImportersDependenciesMap,\n} from './dependencies.ts'\nimport { RollbackRemove } from '@vltpkg/rollback-remove'\nimport type { DepID } from '@vltpkg/dep-id'\nimport { existsSync, rmSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport { load as loadVirtual } from './lockfile/load.ts'\nimport { getImporterSpecs } from './ideal/get-importer-specs.ts'\nimport { lockfile } from './index.ts'\nimport type { Graph } from './index.ts'\nimport { updatePackageJson } from './reify/update-importers-package-json.ts'\n\nexport type InstallOptions = LoadOptions & {\n packageInfo: PackageInfoClient\n cleanInstall?: boolean // Only set by ci command for clean install\n allowScripts: string\n}\n\nexport const install = async (\n options: InstallOptions,\n add?: AddImportersDependenciesMap,\n) => {\n // Validate incompatible options\n if (options.lockfileOnly && options.cleanInstall) {\n throw error(\n 'Cannot use --lockfile-only with --clean-install (ci command). Clean install requires filesystem operations.',\n )\n }\n\n if (options.expectLockfile || options.frozenLockfile) {\n const lockfilePath = resolve(options.projectRoot, 'vlt-lock.json')\n if (!existsSync(lockfilePath)) {\n throw error(\n 'vlt-lock.json file is required when using --expect-lockfile, --frozen-lockfile, or ci command',\n {\n path: lockfilePath,\n },\n )\n }\n }\n\n let mainManifest: NormalizedManifest | undefined = undefined\n try {\n mainManifest = options.packageJson.read(options.projectRoot)\n } catch (err) {\n if (asError(err).message === 'Could not read package.json file') {\n await init({ cwd: options.projectRoot })\n mainManifest = options.packageJson.read(options.projectRoot, {\n reload: true,\n })\n } else {\n throw err\n }\n }\n\n if (options.frozenLockfile) {\n // validates no add/remove operations are requested\n if (add?.modifiedDependencies) {\n const dependencies: string[] = []\n for (const [, deps] of add) {\n for (const [name] of deps) {\n dependencies.push(name)\n }\n }\n throw error(\n 'Cannot add dependencies when using --frozen-lockfile',\n { found: dependencies.join(', ') },\n )\n }\n\n const lockfileGraph = loadVirtual({\n ...options,\n mainManifest,\n })\n\n const emptyAdd = Object.assign(\n new Map<DepID, Map<string, Dependency>>(),\n { modifiedDependencies: false },\n )\n const emptyRemove = Object.assign(new Map<DepID, Set<string>>(), {\n modifiedDependencies: false,\n })\n const importerSpecs = getImporterSpecs({\n graph: lockfileGraph,\n add: emptyAdd,\n remove: emptyRemove,\n ...options,\n })\n\n // Check for spec changes by comparing package.json specs with lockfile edges\n const specChanges: string[] = []\n for (const importer of lockfileGraph.importers) {\n const deps = getDependencies(importer, options)\n for (const [depName, dep] of deps) {\n const edge = importer.edgesOut.get(depName)\n if (edge?.spec) {\n if (edge.spec.toString() !== dep.spec.toString()) {\n const node = lockfileGraph.nodes.get(importer.id)\n /* c8 ignore next */\n const location = node?.location || importer.id\n specChanges.push(\n ` ${location}: ${depName} spec changed from \"${edge.spec}\" to \"${dep.spec}\"`,\n )\n }\n }\n }\n }\n\n if (\n importerSpecs.add.modifiedDependencies ||\n importerSpecs.remove.modifiedDependencies ||\n specChanges.length > 0\n ) {\n const details: string[] = []\n\n if (specChanges.length > 0) {\n details.push(...specChanges)\n }\n\n for (const [importerId, deps] of importerSpecs.add) {\n if (deps.size > 0) {\n const node = lockfileGraph.nodes.get(importerId)\n const location = node?.location || importerId\n const depNames = Array.from(deps.keys())\n const depLabelAdd =\n deps.size === 1 ? 'dependency' : 'dependencies'\n details.push(\n ` ${location}: ${deps.size} ${depLabelAdd} to add (${depNames.join(', ')})`,\n )\n }\n }\n\n for (const [importerId, deps] of importerSpecs.remove) {\n if (deps.size > 0) {\n const node = lockfileGraph.nodes.get(importerId)\n const location = node?.location || importerId\n const depNames = Array.from(deps)\n const depLabelRemove =\n deps.size === 1 ?\n 'dependency'\n : /* c8 ignore next */ 'dependencies'\n details.push(\n ` ${location}: ${deps.size} ${depLabelRemove} to remove (${depNames.join(', ')})`,\n )\n }\n }\n\n const lockfilePath = resolve(\n options.projectRoot,\n 'vlt-lock.json',\n )\n throw error(\n 'Lockfile is out of sync with package.json. Run \"vlt install\" to update.\\n' +\n details.join('\\n'),\n {\n path: lockfilePath,\n },\n )\n }\n }\n\n const remover = new RollbackRemove()\n if (options.cleanInstall) {\n const nodeModulesPath = resolve(\n options.projectRoot,\n 'node_modules',\n )\n if (existsSync(nodeModulesPath)) {\n await remover.rm(nodeModulesPath)\n remover.confirm()\n }\n }\n\n try {\n const remove = Object.assign(new Map<DepID, Set<string>>(), {\n modifiedDependencies: false,\n }) as RemoveImportersDependenciesMap\n const modifiers = GraphModifier.maybeLoad(options)\n\n let act: Graph | undefined = actualLoad({\n ...options,\n mainManifest,\n loadManifests: true,\n modifiers: undefined, // modifiers should not be used here\n })\n // if the actual graph has no dependencies, it's simpler to ignore it\n // this allows us to check for its availability later on for properly\n // handling situations like resetting edges for refreshing the ideal graph\n if (act.importers.size === act.nodes.size) {\n act = undefined\n }\n const graph = await idealBuild({\n ...options,\n actual: act,\n add,\n mainManifest,\n loadManifests: true,\n modifiers,\n remove,\n remover,\n })\n\n // If lockfileOnly is enabled, skip reify and only save the lockfile\n if (options.lockfileOnly) {\n // Save only the main lockfile, skip all filesystem operations\n lockfile.save({ graph, modifiers })\n const saveImportersPackageJson =\n /* c8 ignore next */\n add?.modifiedDependencies || remove.modifiedDependencies ?\n updatePackageJson({\n ...options,\n add,\n graph,\n remove,\n })\n : undefined\n saveImportersPackageJson?.()\n return { graph, diff: undefined }\n }\n\n const { diff, buildQueue } = await reify({\n ...options,\n add,\n actual: act,\n graph,\n loadManifests: true,\n modifiers,\n remove,\n remover,\n })\n\n return { buildQueue, graph, diff }\n } catch (err) {\n /* c8 ignore next */\n await remover.rollback().catch(() => {})\n // Remove hidden lockfile on failure\n try {\n const hiddenLockfile = resolve(\n options.projectRoot,\n 'node_modules/.vlt-lock.json',\n )\n if (existsSync(hiddenLockfile)) {\n rmSync(hiddenLockfile, { force: true })\n }\n } catch {}\n throw err\n }\n}\n", "import type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { LoadOptions } from './actual/load.ts'\nimport { load as actualLoad } from './actual/load.ts'\nimport type { RemoveImportersDependenciesMap } from './dependencies.ts'\nimport { GraphModifier } from './modifiers.ts'\nimport { build as idealBuild } from './ideal/build.ts'\nimport { reify } from './reify/index.ts'\nimport { lockfile } from './index.ts'\nimport { updatePackageJson } from './reify/update-importers-package-json.ts'\nimport { RollbackRemove } from '@vltpkg/rollback-remove'\nimport { existsSync, rmSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nexport type UninstallOptions = LoadOptions & {\n packageInfo: PackageInfoClient\n allowScripts: string\n}\n\nexport const uninstall = async (\n options: UninstallOptions,\n remove?: RemoveImportersDependenciesMap,\n) => {\n const mainManifest = options.packageJson.read(options.projectRoot)\n const modifiers = GraphModifier.maybeLoad(options)\n const remover = new RollbackRemove()\n\n try {\n const graph = await idealBuild({\n ...options,\n remove,\n mainManifest,\n loadManifests: true,\n remover,\n })\n const act = actualLoad({\n ...options,\n mainManifest,\n loadManifests: true,\n })\n\n // If lockfileOnly is enabled, skip reify and only save the lockfile\n if (options.lockfileOnly) {\n // Save only the main lockfile, skip all filesystem operations\n lockfile.save({ graph, modifiers })\n const saveImportersPackageJson =\n /* c8 ignore next */\n remove?.modifiedDependencies ?\n updatePackageJson({\n ...options,\n remove,\n graph,\n })\n : undefined\n saveImportersPackageJson?.()\n return { graph, diff: undefined }\n }\n\n const diff = await reify({\n ...options,\n remove,\n actual: act,\n graph,\n loadManifests: true,\n remover,\n })\n\n return { graph, diff }\n /* c8 ignore start */\n } catch (err) {\n await remover.rollback().catch(() => {})\n // Remove hidden lockfile on failure\n try {\n const hiddenLockfile = resolve(\n options.projectRoot,\n 'node_modules/.vlt-lock.json',\n )\n if (existsSync(hiddenLockfile)) {\n rmSync(hiddenLockfile, { force: true })\n }\n } catch {}\n throw err\n }\n /* c8 ignore stop */\n}\n", "import { load as actualLoad } from './actual/load.ts'\nimport { buildIdealFromStartingGraph } from './ideal/build-ideal-from-starting-graph.ts'\nimport { reify } from './reify/index.ts'\nimport { GraphModifier } from './modifiers.ts'\nimport { init } from '@vltpkg/init'\nimport { asError } from '@vltpkg/types'\nimport type { NormalizedManifest } from '@vltpkg/types'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { LoadOptions } from './actual/load.ts'\nimport { Graph } from './graph.ts'\nimport { graphStep } from '@vltpkg/output'\nimport { RollbackRemove } from '@vltpkg/rollback-remove'\nimport { existsSync, rmSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nexport type UpdateOptions = LoadOptions & {\n packageInfo: PackageInfoClient\n allowScripts: string\n}\n\nexport const update = async (options: UpdateOptions) => {\n let mainManifest: NormalizedManifest | undefined = undefined\n try {\n mainManifest = options.packageJson.read(options.projectRoot)\n } catch (err) {\n if (asError(err).message === 'Could not read package.json file') {\n await init({ cwd: options.projectRoot })\n mainManifest = options.packageJson.read(options.projectRoot, {\n reload: true,\n })\n } else {\n throw err\n }\n }\n\n const modifiers = GraphModifier.maybeLoad(options)\n const remover = new RollbackRemove()\n\n try {\n const done = graphStep('build')\n const graph = await buildIdealFromStartingGraph({\n ...options,\n add: Object.assign(new Map(), { modifiedDependencies: false }),\n remove: Object.assign(new Map(), {\n modifiedDependencies: false,\n }),\n graph: new Graph({ ...options, mainManifest }),\n modifiers,\n remover,\n })\n done()\n\n const act = actualLoad({\n ...options,\n mainManifest,\n loadManifests: true,\n })\n\n const { buildQueue, diff } = await reify({\n ...options,\n actual: act,\n graph,\n loadManifests: true,\n modifiers,\n remover,\n })\n\n return { buildQueue, graph, diff }\n /* c8 ignore start */\n } catch (err) {\n await remover.rollback().catch(() => {})\n // Remove hidden lockfile on failure\n try {\n const hiddenLockfile = resolve(\n options.projectRoot,\n 'node_modules/.vlt-lock.json',\n )\n if (existsSync(hiddenLockfile)) {\n rmSync(hiddenLockfile, { force: true })\n }\n } catch {}\n throw err\n }\n /* c8 ignore stop */\n}\n", "import { Spec } from '@vltpkg/spec/browser'\nimport { joinDepIDTuple } from '@vltpkg/dep-id/browser'\nimport type { SpecOptions } from '@vltpkg/spec/browser'\nimport type { EdgeLike, NodeLike, GraphLike } from '@vltpkg/types'\n\n/**\n * An unique DepID to identify the virtual root node.\n */\nexport const VIRTUAL_ROOT_ID = joinDepIDTuple([\n 'file',\n '__virtual%root__',\n])\n\n/**\n * A virtual root used to aggregate multiple importers into a single graph.\n *\n * This is meant to be used with visual tools that want a single root node\n * starting point to represent the graph.\n *\n * Returns undefined if a virtual root is not needed.\n */\nexport const createVirtualRoot = (\n name = 'virtual-root',\n options: SpecOptions,\n mainImporters: NodeLike[],\n): NodeLike | undefined => {\n const res = {\n id: VIRTUAL_ROOT_ID,\n name,\n version: '1.0.0',\n manifest: {\n name,\n version: '1.0.0',\n },\n edgesIn: new Set(),\n edgesOut: new Map<string, EdgeLike>([]),\n confused: false,\n importer: true,\n mainImporter: true,\n location: '.',\n graph: { importers: new Set() } as GraphLike,\n projectRoot: '',\n dev: false,\n optional: false,\n options,\n setConfusedManifest() {},\n setResolved() {},\n maybeSetConfusedManifest() {},\n workspaces: undefined,\n toJSON() {\n return {\n id: this.id,\n name: this.name,\n version: this.version,\n location: this.location,\n importer: this.importer,\n manifest: this.manifest,\n projectRoot: this.projectRoot,\n integrity: this.integrity,\n resolved: this.resolved,\n dev: this.dev,\n optional: this.optional,\n confused: false,\n }\n },\n } satisfies NodeLike\n\n // @ts-expect-error\n res[Symbol.toStringTag] = '@vltpkg/graph.Node'\n\n // link all mainImporters to the virtual root\n for (const importer of mainImporters) {\n const name = importer.name || '(unknown)'\n if (importer.mainImporter) {\n const spec = Spec.parse(name, 'file:.', options)\n const edge = {\n name: spec.name,\n from: res,\n to: importer,\n spec,\n type: 'prod',\n } satisfies EdgeLike\n res.edgesOut.set(name, edge)\n importer.edgesIn.add(edge)\n }\n }\n return res\n}\n", "export * from './build.ts'\nexport * from './edge.ts'\nexport * from './graph.ts'\nexport * from './node.ts'\nexport * from './dependencies.ts'\nexport * from './fixup-added-names.ts'\nexport * from './lockfile/types.ts'\nexport * from './visualization/json-output.ts'\nexport * from './visualization/human-readable-output.ts'\nexport * from './visualization/mermaid-output.ts'\nexport * from './stringify-node.ts'\nexport * from './install.ts'\nexport * from './uninstall.ts'\nexport * from './update.ts'\nexport * from './diff.ts'\nexport * from './modifiers.ts'\nexport * from './virtual-root.ts'\n\nimport { load as actualLoad } from './actual/load.ts'\nimport type { LoadOptions as ActualLoadOptions } from './actual/load.ts'\nexport const actual = { load: actualLoad }\n\nimport { load as lockfileLoad } from './lockfile/load.ts'\nimport type { LoadOptions as LockfileLoadOptions } from './lockfile/load.ts'\nimport { loadEdges } from './lockfile/load-edges.ts'\nimport { loadNodes } from './lockfile/load-nodes.ts'\nimport { save } from './lockfile/save.ts'\nexport const lockfile = {\n load: lockfileLoad,\n loadEdges,\n loadNodes,\n save,\n}\n\nexport type { ActualLoadOptions, LockfileLoadOptions }\nexport type { SaveOptions } from './lockfile/save.ts'\n\nimport { build } from './ideal/build.ts'\nimport type { BuildIdealOptions } from './ideal/build.ts'\nexport type { BuildIdealOptions }\nexport const ideal = { build }\n\nexport { reify } from './reify/index.ts'\nexport type { ReifyOptions } from './reify/index.ts'\nexport type { BuildResult } from './reify/build.ts'\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,WAAO,UAAU;AACjB,UAAM,OAAO;AAEb,QAAIA,MAAK,UAAQ,SAAI;AAErB,aAAS,aAAcC,OAAM,SAAS;AACpC,UAAI,UAAU,QAAQ,YAAY,SAChC,QAAQ,UAAU,QAAQ,IAAI;AAEhC,UAAI,CAAC,SAAS;AACZ,eAAO;AAAA,MACT;AAEA,gBAAU,QAAQ,MAAM,GAAG;AAC3B,UAAI,QAAQ,QAAQ,EAAE,MAAM,IAAI;AAC9B,eAAO;AAAA,MACT;AACA,eAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;AACvC,YAAI,IAAI,QAAQ,CAAC,EAAE,YAAY;AAC/B,YAAI,KAAKA,MAAK,OAAO,CAAC,EAA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kBAAkB;AAAA,UAChB,GAAG;AAAA,UACH;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC,IACD;AAAA;AACJ,iCAA2B;AAC3B,aAAO,EAAE,OAAO,MAAM,OAAU;AAAA,IAClC;AAEA,UAAM,EAAE,MAAM,WAAW,IAAI,MAAM,MAAM;AAAA,MACvC,GAAG;AAAA,MACH;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,MACA,eAAe;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAED,WAAO,EAAE,YAAY,OAAO,KAAK;AAAA,EACnC,SAAS,KAAK;AAEZ,UAAM,QAAQ,SAAS,EAAE,MAAM,MAAM;AAAA,IAAC,CAAC;AAEvC,QAAI;AACF,YAAM,iBAAiBH;AAAA,QACrB,QAAQ;AAAA,QACR;AAAA,MACF;AACA,UAAIC,YAAW,cAAc,GAAG;AAC9B,QAAAG,QAAO,gBAAgB,EAAE,OAAO,KAAK,CAAC;AAAA,MACxC;AAAA,IACF,QAAQ;AAAA,IAAC;AACT,UAAM;AAAA,EACR;AACF;",
|
|
6
|
+
"names": ["fs", "path", "stat", "fs", "path", "stat", "fs", "path", "resolve", "is", "path", "resolve", "is", "path", "env", "path", "fs", "path", "parse", "parse", "spawn", "cloneNode", "type", "Node", "_getRequireWildcardCache", "nodeInterop", "_setPrototypeOf", "o", "p", "Container", "id", "empty", "walk", "split", "_setPrototypeOf", "o", "p", "Root", "error", "_setPrototypeOf", "o", "p", "Selector", "merge", "cssesc", "_setPrototypeOf", "o", "p", "ClassName", "_setPrototypeOf", "o", "p", "Comment", "_setPrototypeOf", "o", "p", "ID", "_setPrototypeOf", "o", "p", "Namespace", "_setPrototypeOf", "o", "p", "Tag", "_setPrototypeOf", "o", "p", "String", "_setPrototypeOf", "o", "p", "Pseudo", "require_node", "_setPrototypeOf", "o", "p", "Attribute", "_setPrototypeOf", "o", "p", "Universal", "_setPrototypeOf", "o", "p", "Combinator", "_setPrototypeOf", "o", "p", "Nesting", "combinator", "_getRequireWildcardCache", "nodeInterop", "_getRequireWildcardCache", "nodeInterop", "Parser", "attribute", "attr", "combinator", "error", "pseudo", "current", "parse", "Processor", "resolve", "root", "process", "attribute", "className", "combinator", "comment", "id", "nesting", "pseudo", "root", "selector", "string", "tag", "universal", "isNode", "type", "selectors", "_getRequireWildcardCache", "nodeInterop", "parser", "satisfies", "id", "spec", "type", "version", "Spec", "type", "spec", "satisfies", "version", "type", "nameVersion", "optional", "dev", "id", "spec", "version", "type", "confused", "process", "global", "load", "spawn", "crossSpawn", "resolve", "env", "paths", "resolve", "empty", "shell", "scripts", "signal", "runImpl", "scope", "parse", "root", "postcssSelectorParser", "type", "attribute", "attr", "edge", "parseInternals", "parseInternals", "cwe", "parseInternals", "parseInternals", "type", "path", "kindsMap", "kinds", "parseInternals", "error", "error", "resolve", "kinds", "spec", "parseInternals", "version", "path", "type", "version", "spec", "parseInternals", "queueNode", "kinds", "parseInternals", "scripts", "parseInternals", "attribute", "kindsMap", "kindLevelMap", "kinds", "parseInternals", "kindLevelMap", "kindsMap", "parseInternals", "kindsMap", "kindLevelMap", "kinds", "parseInternals", "kinds", "kindsMap", "kindLevelMap", "type", "node", "parse", "resolve", "dirname", "version", "dirname", "id", "scope", "score", "isObj", "type", "spec", "inspect", "mkdirSync", "dirname", "resolve", "init", "resolve", "mkdirSync", "dirname", "kCustomInspect", "spec", "Spec", "type", "satisfies", "id", "version", "os", "inspect", "resolve", "id", "spec", "actual", "id", "type", "version", "dev", "optional", "resolve", "load", "lockfileData", "readFileSync", "type", "spec", "path", "hydrate", "Spec", "load", "graph", "join", "optional", "del", "statSync", "chmod", "path", "path", "scripts", "install", "join", "kCustomInspect", "id", "build", "load", "missing", "spawn", "dirname", "resolve", "path", "dirname", "env", "spawn", "pseudoSelectors", "removeQuotes", "parse", "Spec", "spec", "satisfies", "Spec", "stat", "id", "spec", "Spec", "spec", "hydrate", "error", "spec", "type", "spec", "type", "satisfies", "spec", "path", "id", "isStringArray", "type", "peer", "actual", "Spec", "actual", "getMap", "id", "type", "path", "build", "load", "availableParallelism", "limit", "resolve", "run", "chmod", "mkdir", "readFile", "stat", "writeFile", "dirname", "relative", "dirname", "resolve", "path", "path", "path", "resolve", "dirname", "stat", "mkdir", "dirname", "readFile", "relative", "writeFile", "chmod", "mkdir", "dirname", "relative", "link", "type", "er", "path", "target", "path", "join", "nodeNeedsBuild", "scripts", "mkdir", "symlink", "dirname", "relative", "id", "path", "path", "spec", "availableParallelism", "filterNodesByQuery", "actual", "load", "existsSync", "rmSync", "resolve", "existsSync", "resolve", "build", "load", "existsSync", "rmSync", "resolve", "load", "name", "spec", "load", "resolve", "existsSync", "load", "build", "rmSync"]
|
|
7
|
+
}
|